mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
[flake8-builtins
] Make strict module name comparison optional (A005
) (#15951)
## Summary This PR adds the configuration option `lint.flake8-builtins.builtins-strict-checking`, which is used in A005 to determine whether the fully-qualified module name (relative to the project root or source directories) should be checked instead of just the final component as is currently the case. As discussed in https://github.com/astral-sh/ruff/issues/15399#issuecomment-2587017147, the default value of the new option is `false` on preview, so modules like `utils.logging` from the initial report are no longer flagged by default. For non-preview the default is still strict checking. ## Test Plan New A005 test module with the structure reported in #15399. Fixes #15399
This commit is contained in:
parent
f367aa8367
commit
88b543d73a
9 changed files with 175 additions and 76 deletions
|
@ -234,6 +234,13 @@ impl Configuration {
|
|||
|
||||
let rules = lint.as_rule_table(lint_preview)?;
|
||||
|
||||
let flake8_builtins = lint
|
||||
.flake8_builtins
|
||||
.map(|builtins| builtins.into_settings(lint_preview))
|
||||
.unwrap_or_else(|| {
|
||||
ruff_linter::rules::flake8_builtins::settings::Settings::new(lint_preview)
|
||||
});
|
||||
|
||||
// LinterSettings validation
|
||||
let isort = lint
|
||||
.isort
|
||||
|
@ -335,10 +342,7 @@ impl Configuration {
|
|||
.flake8_bugbear
|
||||
.map(Flake8BugbearOptions::into_settings)
|
||||
.unwrap_or_default(),
|
||||
flake8_builtins: lint
|
||||
.flake8_builtins
|
||||
.map(Flake8BuiltinsOptions::into_settings)
|
||||
.unwrap_or_default(),
|
||||
flake8_builtins,
|
||||
flake8_comprehensions: lint
|
||||
.flake8_comprehensions
|
||||
.map(Flake8ComprehensionsOptions::into_settings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue