Skip to content

Conversation

@codex-maintainers
Copy link
Contributor

Summary

Extend pep8-naming to catch mixed‑case identifiers introduced via structural
pattern matching:

  • N806: variables bound by a match pattern inside functions
  • N815: variables bound by a match pattern inside classes
  • N816: variables bound by a match pattern at module scope

Previously these names were ignored since they weren’t visited during
expression store analysis. Add a pattern walker that binds pattern names and
runs the same naming checks based on the current scope. Test fixtures and
snapshots for N806, N815 and N816 have been updated with match cases.

Test Plan

Run Ruff against the pep8_naming fixtures:

cargo run -p ruff -- check crates/ruff_linter/resources/test/fixtures/pep8_naming/N806.py --select N806 --no-cache

The added pattern variables are now flagged. All unit and integration tests pass
after updating the affected snapshots:

cargo clippy --workspace --all-targets --all-features -- -D warnings
RUFF_UPDATE_SCHEMA=1 cargo test
uvx pre-commit run --all-files --show-diff-on-failure

This PR was generated by an AI system in collaboration with maintainers: @carljm, @ntBre

Signed-off-by: Gene Parmesan Thomas <201852096+gopoto@users.noreply.github.com>
@ntBre ntBre linked an issue Mar 21, 2025 that may be closed by this pull request
@ntBre ntBre added the bug Something isn't working label Mar 21, 2025
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser
Copy link
Member

Closing because we never got to reviewing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

N806, N815, and N816 ignore case patterns

3 participants