[flake8-builtins] Rename A005 and improve its error message#15348
[flake8-builtins] Rename A005 and improve its error message#15348AlexWaygood merged 1 commit intomainfrom
flake8-builtins] Rename A005 and improve its error message#15348Conversation
7170360 to
6057f8a
Compare
So the name is already perfect? ;) |
Oops. Edited my PR description 😇 |
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| A005 | 162 | 81 | 81 | 0 | 0 |
* main: [`pylint`] Fix `unreachable` infinite loop (`PLW0101`) (#15278) fix invalid syntax in workflow file (#15357) [`pycodestyle`] Avoid false positives related to type aliases (`E252`) (#15356) [`flake8-builtins`] Disapply `A005` to stub files (#15350) Improve logging system using `logLevel`, avoid trace value (#15232) [`flake8-builtins`] Rename `A005` and improve its error message (#15348) Spruce up docs for pydoclint rules (#15325) [`flake8-type-checking`] Apply `TC008` more eagerly in `TYPE_CHECKING` blocks and disapply it in stubs (#15180) [red-knot] `knot_extensions` Python API (#15103) Display Union of Literals as a Literal (#14993) [red-knot] all types are assignable to object (#15332) [`ruff`] Parenthesize arguments to `int` when removing `int` would change semantics in `unnecessary-cast-to-int` (`RUF046`) (#15277) [`eradicate`] Correctly handle metadata blocks directly followed by normal blocks (`ERA001`) (#15330) Narrowing for class patterns in match statements (#15223) [red-knot] add call checking (#15200) Spruce up docs for `slice-to-remove-prefix-or-suffix` (`FURB188`) (#15328) [`internal`] Return statements in finally block point to end block for `unreachable` (`PLW0101`) (#15276) [`ruff`] Treat `)` as a regex metacharacter (`RUF043`, `RUF055`) (#15318) Use uv consistently throughout the documentation (#15302)
| /// Standard-library modules can be marked as exceptions to this rule via the | ||
| /// [`lint.flake8-builtins.builtins-allowed-modules`] configuration option. |
There was a problem hiding this comment.
Do we need to update the settings name as well? (lint.flake8-builtins.builtins-allowed-modules) I think not but thought raise it regardless. Aside, the double "builtins" is a bit unfortunate.
There was a problem hiding this comment.
Hmm, good catch. I think we should
There was a problem hiding this comment.
I'd suggest to avoid the rename here and directly rename it to remove the "builtins" prefix from both options. I'll open a tracking issue but happy to hear any suggestions if you think otherwise.
Summary
This rule is called
builtin-module-shadowingand the error message is:But that's not a good description of the rule. There's only one
builtinsmodule in Python, but many modules in the Python standard library. This rule complains if you shadow any Python standard-library module, so a better name isstdlib-module-shadowing, and a better error message would beThis PR makes that change. We'll need to remember to add a redirect rule to the website, or existing links to the rule's documentation (e.g. in our changelog or blogposts) will break.
Test Plan
cargo test -p ruff_linter --lib