Skip to content

Commit fbe173c

Browse files
committed
linter fixes
1 parent b28eb16 commit fbe173c

65 files changed

Lines changed: 310 additions & 234 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.copier-answers.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: v0.4.0
2+
_commit: v0.7.1
33
_src_path: gh:ahcodedev/python-project-template
44
description: Various Data Structures and Algorithm Solutions in Python
55
github_repo: ahcodedev/python-ds-algorithms
66
package_name: python_ds_algorithms
77
project_name: python-ds-algorithms
8+
use_docs: false
9+
use_releases: false

‎.github/dependabot.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ updates:
77
- package-ecosystem: "github-actions"
88
directory: "/"
99
schedule:
10-
interval: "monthly"
10+
interval: "weekly"
1111
cooldown:
1212
default-days: 7
1313
labels: ["dependencies"]
1414
groups:
1515
github-actions:
16-
patterns: ["*"]
16+
update-types: ["minor", "patch"]
1717

1818
# Python dependencies in pyproject.toml / uv.lock
1919
- package-ecosystem: "uv"
2020
directory: "/"
2121
schedule:
22-
interval: "monthly"
22+
interval: "weekly"
2323
cooldown:
2424
default-days: 7
2525
labels: ["dependencies"]
@@ -31,7 +31,7 @@ updates:
3131
- package-ecosystem: "docker"
3232
directory: "/.devcontainer"
3333
schedule:
34-
interval: "monthly"
34+
interval: "weekly"
3535
cooldown:
3636
default-days: 7
3737
labels: ["dependencies"]
@@ -40,7 +40,7 @@ updates:
4040
- package-ecosystem: "devcontainers"
4141
directory: "/"
4242
schedule:
43-
interval: "monthly"
43+
interval: "weekly"
4444
cooldown:
4545
default-days: 7
4646
labels: ["dependencies"]

‎.github/pull_request_template.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
## Checklist
1010

1111
- [ ] `just lint` passes
12-
- [ ] `just test` passes
12+
- [ ] `just coverage` passes
1313
- [ ] Tests added or updated for the change
1414
- [ ] `README.md` updated if needed

‎.github/workflows/dependabot-auto-merge.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ on:
99

1010
permissions: {}
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
1216
jobs:
1317
auto-merge:
1418
if: github.event.pull_request.user.login == 'dependabot[bot]'
15-
runs-on: ubuntu-slim
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 15
1621
permissions:
1722
contents: write
1823
pull-requests: write

‎.github/workflows/python.yml‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ on:
88

99
permissions: {}
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
14+
1115
jobs:
1216
code-check-and-unit-test:
13-
runs-on: ubuntu-slim
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
1419
permissions:
1520
contents: read
1621
steps:
@@ -24,16 +29,21 @@ jobs:
2429
version: ">=0.13,<0.14"
2530
- name: Setup environment
2631
run: |
27-
uv tool install rust-just
32+
uv tool install rust-just==1.59.0
33+
uv tool install actionlint-py==1.7.12.25
34+
uv tool install yamllint==1.38.0
2835
just sync
2936
- name: Lint
3037
run: |
3138
just ci-lint
39+
- name: Spell check
40+
uses: crate-ci/typos@276087d9a4f06398b3e04825487805e2d7375888 # v1.52.2
3241
- name: Unit tests
3342
run: |
34-
just test
43+
just coverage
3544
markdownlint:
36-
runs-on: ubuntu-slim
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 15
3747
permissions:
3848
contents: read
3949
steps:

‎.github/workflows/security.yml‎

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ on:
88

99
permissions: {}
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
14+
1115
jobs:
1216
zizmor:
13-
runs-on: ubuntu-slim
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
1419
permissions:
1520
contents: read # only needed for private or internal repos
1621
actions: read # only needed for private or internal repos
@@ -25,7 +30,8 @@ jobs:
2530
with:
2631
advanced-security: false
2732
pip-audit:
28-
runs-on: ubuntu-slim
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 15
2935
permissions:
3036
contents: read
3137
steps:
@@ -40,20 +46,30 @@ jobs:
4046
version: ">=0.13,<0.14"
4147
- name: Setup environment
4248
run: |
43-
uv tool install rust-just
49+
uv tool install rust-just==1.59.0
4450
just sync
4551
- name: Audit dependencies
4652
run: |
4753
just audit
48-
gitleaks:
49-
runs-on: ubuntu-slim
54+
betterleaks:
55+
runs-on: ubuntu-latest
56+
timeout-minutes: 15
57+
permissions:
58+
contents: read # needed to check out a private repo
5059
steps:
5160
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5261
with:
53-
persist-credentials: false
54-
fetch-depth: 0
55-
- name: Check gitleaks
56-
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
GITLEAKS_ENABLE_COMMENTS: false
62+
persist-credentials: false
63+
fetch-depth: 0
64+
# betterleaks has no official action or PyPI package, so it is built from source
65+
- name: Install Go
66+
uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
67+
with:
68+
go-version: stable
69+
cache: false
70+
- name: Install betterleaks
71+
run: |
72+
go install github.com/betterleaks/betterleaks@v1.10.1
73+
- name: Scan git history for secrets
74+
run: |
75+
"$(go env GOPATH)/bin/betterleaks" git --redact .

‎.gitignore‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
# Byte-compiled files
1+
# Python
22
__pycache__/
33
*.py[cod]
44

5-
# OS
6-
.DS_Store
5+
# Build and packaging
6+
build/
7+
dist/
8+
*.egg-info/
79

8-
# Test / coverage reports
10+
# Virtual environments and environment files
11+
.venv/
12+
.env*
13+
14+
# Test and tool caches
915
.coverage
1016
.coverage.*
11-
htmlcov/
1217
.pytest_cache/
18+
.ruff_cache/
19+
htmlcov/
20+
coverage.xml
1321

14-
# Environments
15-
.env
16-
.venv
17-
18-
# Ruff
19-
.ruff_cache
22+
# OS
23+
.DS_Store
2024

21-
# Claude
22-
.claude/*.local.*
25+
# Claude (committing Claude files is opt-in)
26+
.claude/
27+
.claude/settings.local.json
2328
CLAUDE.md
29+
CLAUDE.md.example
2430

2531
# Dev Container
2632
.devcontainer/devcontainer-lock.json

‎.yamllint.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Configuration file for yamllint.
2+
# See https://yamllint.readthedocs.io/en/stable/configuration.html
3+
extends: default
4+
5+
ignore: |
6+
.venv/
7+
site/
8+
9+
rules:
10+
document-start: disable
11+
# Allow both list styles under a key, as long as each file is consistent
12+
indentation:
13+
indent-sequences: consistent
14+
line-length:
15+
max: 120
16+
# `on:` in GitHub workflows is a key, not a boolean
17+
truthy:
18+
check-keys: false
19+
brackets:
20+
max-spaces-inside: 1
21+
comments:
22+
min-spaces-from-content: 1

‎Brewfile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
brew "gitleaks"
1+
brew "actionlint"
2+
brew "betterleaks"
3+
brew "copier"
4+
brew "jq"
25
brew "just"
36
brew "markdownlint-cli2"
7+
brew "typos-cli"
48
brew "uv"
9+
brew "yamllint"
510
brew "zizmor"

‎README.md‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
[![CI](https://github.com/ahcodedev/python-ds-algorithms/actions/workflows/python.yml/badge.svg?branch=main)](https://github.com/ahcodedev/python-ds-algorithms/actions/workflows/python.yml)
44
[![Security](https://github.com/ahcodedev/python-ds-algorithms/actions/workflows/security.yml/badge.svg?branch=main)](https://github.com/ahcodedev/python-ds-algorithms/actions/workflows/security.yml)
5-
[![gitleaks](https://img.shields.io/badge/protected%20by-gitleaks-blue)](https://github.com/gitleaks/gitleaks)
5+
[![betterleaks](https://img.shields.io/badge/protected%20by-betterleaks-blue)](https://github.com/betterleaks/betterleaks)
6+
[![zizmor](https://img.shields.io/badge/%F0%9F%8C%88-zizmor-white?labelColor=white)](https://zizmor.sh/)
67

78
Various Data Structures and Algorithm Solutions in Python (3.x). Succinct Python one-liners are avoided in most solutions
89
to prevent obscuring the function and logic of the algorithms / data-structures.
@@ -52,24 +53,28 @@ manage project configuration and commands
5253

5354
* `just setup` - install Homebrew tools from the `Brewfile` and sync the project
5455
* `just sync` - sync project dependencies (all groups)
55-
* `just lint` - type check, lint, format, spellcheck, and lint workflows (actionlint) (applies fixes)
56-
* `just ci-lint` - run the same checks without modifying files (used in CI)
56+
* `just lint` - type check, lint, format, spell check (typos), and lint workflows (actionlint), YAML (yamllint),
57+
and JSON (jq) (applies fixes)
58+
* `just ci-lint` - run the same checks without modifying files, except spell check (used in CI)
59+
* `just spellcheck` - check spelling with typos
5760
* `just test` - run unit tests
61+
* `just coverage` - run unit tests with coverage (fails under 98%)
5862
* `just audit` - check dependencies for known vulnerabilities with pip-audit
5963
* `just markdownlint` - lint Markdown files with markdownlint-cli2
6064
* `just prek` - run pre-commit hooks via prek
61-
* `just git-leaks` - scan staged changes for secrets with gitleaks
65+
* `just betterleaks` - scan staged changes for secrets with betterleaks
6266
* `just zizmor` - audit GitHub Actions workflows for security issues
67+
* `just update-template` - pull in the latest changes from the Copier template
6368
* `uv add {package}` - install a dependency
6469

6570
## CI and Security
6671

67-
| Workflow | Runs on | Purpose |
68-
| --------------------- | ----------------------- | -------------------------------------------- |
69-
| `python.yml` | push / PR to `main` | lint, unit tests, markdownlint |
70-
| `security.yml` | push to `main`, all PRs | zizmor, gitleaks, pip-audit dependency audit |
72+
| Workflow | Runs on | Purpose |
73+
| --------------------- | ----------------------- | ------------------------------------------------------- |
74+
| `python.yml` | push / PR to `main` | lint, spell check, unit tests, markdownlint |
75+
| `security.yml` | push to `main`, all PRs | zizmor, betterleaks, pip-audit dependency audit |
7176

7277
* GitHub Actions are pinned to full commit SHAs, with the version in a trailing comment
73-
* Dependabot (`.github/dependabot.yml`) checks monthly for updates to GitHub Actions, Python
78+
* Dependabot (`.github/dependabot.yml`) checks weekly for updates to GitHub Actions, Python
7479
dependencies, the dev container image, and dev container features. New releases wait 7 days
7580
before an update is proposed. Dependabot PRs get the `dependencies` label

0 commit comments

Comments
 (0)