mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00
[flake8-builtins
] Default to non-strict checking (A005
) (#16125)
## Summary This PR changes the default value of `lint.flake8-builtins.builtins-strict-checking` added in https://github.com/astral-sh/ruff/pull/15951 from `true` to `false`. This also allows simplifying the default option logic and removes the dependence on preview mode. https://github.com/astral-sh/ruff/issues/15399 was already closed by #15951, but this change will finalize the behavior mentioned in https://github.com/astral-sh/ruff/issues/15399#issuecomment-2587017147. As an example, strict checking flags modules based on their last component, so `utils/logging.py` triggers A005. Non-strict checking checks the path to the module, so `utils/logging.py` is allowed (this is the example and desired behavior from #15399 exactly) but a top-level `logging.py` or `logging/__init__.py` is still disallowed. ## Test Plan Existing tests from #15951 and #16006, with the snapshot updated in `a005_module_shadowing_strict_default` to reflect the new default.
This commit is contained in:
parent
958e1177ce
commit
a04347b7a3
8 changed files with 23 additions and 46 deletions
|
@ -235,13 +235,6 @@ 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
|
||||
|
@ -344,7 +337,10 @@ impl Configuration {
|
|||
.flake8_bugbear
|
||||
.map(Flake8BugbearOptions::into_settings)
|
||||
.unwrap_or_default(),
|
||||
flake8_builtins,
|
||||
flake8_builtins: lint
|
||||
.flake8_builtins
|
||||
.map(Flake8BuiltinsOptions::into_settings)
|
||||
.unwrap_or_default(),
|
||||
flake8_comprehensions: lint
|
||||
.flake8_comprehensions
|
||||
.map(Flake8ComprehensionsOptions::into_settings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue