ruff
cdceabe6 - [`pep8-naming`] Allow trailing underscores in class names (`N801`) (#31130)

Commit
7 hours ago
[`pep8-naming`] Allow trailing underscores in class names (`N801`) (#31130) ## Summary Fixes #30230. `non_camel_case_class_name` in `non_camel_case_class_name.rs` only stripped leading underscores (`trim_start_matches('_')`), so valid PEP 8 class names with trailing underscores like `Fine_` were still flagged. Changed it to `trim_matches('_')` to strip both leading and trailing underscores, matching upstream `pep8-naming` (while still flagging internal underscores like `Bad_Class_`, lowercase names like `bad_`, and underscore-only names like `_` and `__`). Added test cases to `N801.py` and updated the snapshot. Ran `cargo test -p ruff_linter`, `cargo clippy`, and `cargo fmt --check` locally. AI disclosure: Used AI to help check edge cases and upstream behavior; I reviewed the diff and ran the checks myself.
Author
Parents
Loading