Skip to content

ci: lint tools, tests and examples with a hash-pinned ruff - #126

Merged
drevendev merged 1 commit into
masterfrom
beautifulrepo/ruff-ci-20261023
Oct 23, 2026
Merged

drevendev merged 1 commit into
masterfrom
beautifulrepo/ruff-ci-20261023

Conversation

@drevendev

Copy link
Copy Markdown
Owner

Reader problem and change

About 2,000 lines of Python in tools/, tests/ and examples/ had no linter, so unused names and likely bugs were caught only in review.

  • A separate Lint job installs ruff 0.16.10 with pip install --require-hashes --no-deps -r .github/lint-requirements.txt. It runs ruff check --output-format github.
  • ruff.toml selects a small rule set: E4, E7, E9, F (pyflakes) and B (bugbear). There are no style or formatting rules.
  • The first run reported 20 findings, all fixed here:
    • 12 semicolon-joined statements in tests/test_catalog.py are split, at the exact columns ruff reported;
    • an unused variable in tests/test_curated_starter.py is removed;
    • the deliberate import after a sys.path entry in examples/repository-audit/demo.py is marked # noqa: E402;
    • six zip() calls now pass strict=True, three in the tools and three in the tests. In each case the lengths are equal by construction, so a future mismatch fails loudly instead of being truncated silently.
  • CONTRIBUTING says linting is CI-only and optional locally. tests/test_lint_setup.py checks the exact pin and hash, the hash-checked install, and that no tool or example imports ruff.

Closes #55

Evidence

ruff 0.16.10 was published to PyPI on 2026-10-01. Locally, in a scratch virtualenv: All checks passed!. The behaviour of the three tool zip() calls is unchanged, and all 304 tests pass.

Verification

  • The five local checks passed on Windows 11 with Python 3.14.7: catalog OK; docs links 200; HTML navigation 211; 304 tests OK, 7 skipped; repo audit 0 findings.
  • This PR's CI is the first run of the Lint job on a runner.

Limitations

  • The hash pins the manylinux x86-64 wheel that ubuntu-latest uses. Other platforms install the same version without the hash check.
  • The owner adds Lint to the master ruleset once it has stayed green for a while, as Run linters and type checkers in CI #55 suggests; this PR does not change the ruleset. Dependabot does not watch the pin yet.

🤖 Generated with Claude Code

About 2,000 lines of Python had no linter, so unused names and similar bug
classes were caught only in review. A separate Lint job installs ruff 0.16.10
by hash (.github/lint-requirements.txt) and runs it with ruff.toml: syntax and
statement errors, pyflakes and bugbear, no style rules. The first run's 20
findings are fixed in this commit: 12 semicolon-joined test statements are
split, an unused test variable is removed, a deliberate import after a
sys.path entry is marked, and six zip() calls state strict=True where the
lengths are equal by construction. CONTRIBUTING explains that linting is
CI-only; the tools still import nothing outside the standard library. The job
is not added to the required checks yet.

Closes #55

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@drevendev
drevendev force-pushed the beautifulrepo/ruff-ci-20261023 branch from 6981f9a to ecfd2ce Compare October 23, 2026 09:13
@drevendev
drevendev merged commit aa7bcca into master Oct 23, 2026
6 checks passed
@drevendev
drevendev deleted the beautifulrepo/ruff-ci-20261023 branch October 23, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run linters and type checkers in CI

1 participant