Skip to content

Scope the linter rule to Python and guard the formatters - #2

Merged
anwai98 merged 1 commit into
mainfrom
scope-linter-rule
Jul 25, 2026
Merged

anwai98 merged 1 commit into
mainfrom
scope-linter-rule

Conversation

@anwai98

@anwai98 anwai98 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

What

The flake8 rule made flake8 the only linter for every language. This scopes it to Python and adds hook enforcement for the formatters.

Why

The rule forbade shellcheck, which this repository needs and its own CI runs. It also left a JavaScript, Go, or Rust repository with no allowed linter, and AGENTS.md gives a global rule precedence over a repository instruction, so no repository could opt out.

Changes

  • AGENTS.md: the rule now covers the style linters and the formatters of Python only. A linter for another language, a type checker, a manifest validator, and a test runner stay allowed. The hand-fix mandate applies to the code you add, and it carves out an __init__.py file and a finding that the formatter of the repository produces.
  • AGENTS.md: the read-only forms stay allowed, because black --check, ruff check, and isort --check-only never write a file. The write forms stay forbidden.
  • hooks/enforce-rules.sh: the ban is no longer prose only. The guard denies black, isort, ruff format, and ruff check --fix. It finds them after a runner, after python -m, and after uvx or uv tool run. A read-only flag counts only in an option position, so black --exclude --check . stays denied.
  • tests/test-hooks.sh: 49 new cases. The suite passes 222 of 222.

Verification

  • tests/test-hooks.sh: 222 passed, 0 failed
  • shellcheck hooks/*.sh tests/*.sh: clean
  • bash -n on both scripts: clean

🤖 Generated with Claude Code

The rule made flake8 the only linter for every language, so it forbade
shellcheck and left a Go or Rust repository with no allowed linter. It
now covers the style linters and the formatters of Python only. The
hand-fix mandate applies to the code you add.

The read-only forms stay allowed, because `black --check` and
`isort --check-only` never write a file. The write forms stay forbidden,
and hooks/enforce-rules.sh now denies black, isort, `ruff format`, and
`ruff check --fix`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@anwai98
anwai98 merged commit 5935943 into main Jul 25, 2026
5 checks passed
@anwai98
anwai98 deleted the scope-linter-rule branch July 25, 2026 14:43
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.

1 participant