[flake8-builtins] Match upstream module name comparison (A005)#16006
Merged
[flake8-builtins] Match upstream module name comparison (A005)#16006
flake8-builtins] Match upstream module name comparison (A005)#16006Conversation
See #15951 for the original discussion and reviews. This is just the first half of that PR (reaching parity with `flake8-builtins` without adding any new configuration options) split out for nicer changelog entries.
ntBre
commented
Feb 6, 2025
ntBre
commented
Feb 6, 2025
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| A005 | 34 | 26 | 8 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+26 -8 violations, +0 -0 fixes in 4 projects; 51 projects unchanged)
apache/airflow (+20 -8 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ airflow/api_fastapi/logging/__init__.py:1:1: A005 Module `logging` shadows a Python standard-library module + airflow/io/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module + airflow/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module - providers/common/io/src/airflow/providers/common/io/assets/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module - providers/common/io/src/airflow/providers/common/io/assets/assets/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module - providers/common/io/src/airflow/providers/common/io/operators/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module - providers/common/io/src/airflow/providers/common/io/xcom/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module + providers/common/io/tests/provider_tests/common/io/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module + providers/google/src/airflow/providers/google/cloud/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/google/tests/provider_tests/google/cloud/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/hashicorp/src/airflow/providers/hashicorp/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/hashicorp/tests/provider_tests/hashicorp/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module - providers/http/src/airflow/providers/http/hooks/__init__.py:1:1: A005 Module `http` shadows a Python standard-library module - providers/http/src/airflow/providers/http/operators/__init__.py:1:1: A005 Module `http` shadows a Python standard-library module - providers/http/src/airflow/providers/http/sensors/__init__.py:1:1: A005 Module `http` shadows a Python standard-library module - providers/http/src/airflow/providers/http/triggers/__init__.py:1:1: A005 Module `http` shadows a Python standard-library module + providers/http/tests/provider_tests/http/__init__.py:1:1: A005 Module `http` shadows a Python standard-library module + providers/opsgenie/src/airflow/providers/opsgenie/typing/__init__.py:1:1: A005 Module `typing` shadows a Python standard-library module + providers/opsgenie/tests/provider_tests/opsgenie/typing/__init__.py:1:1: A005 Module `typing` shadows a Python standard-library module + providers/src/airflow/providers/amazon/aws/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/src/airflow/providers/microsoft/azure/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/tests/amazon/aws/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/tests/email/__init__.py:1:1: A005 Module `email` shadows a Python standard-library module + providers/tests/microsoft/azure/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/yandex/src/airflow/providers/yandex/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + providers/yandex/tests/provider_tests/yandex/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module + tests/io/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module + tests/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module
bokeh/bokeh (+3 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ examples/interaction/widgets/fileinput.py:1:1: A005 Module `fileinput` shadows a Python standard-library module + src/bokeh/io/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module + src/bokeh/models/annotations/html/__init__.py:1:1: A005 Module `html` shadows a Python standard-library module
latchbio/latch (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
+ src/latch/idl/core/types.py:1:1: A005 Module `types` shadows a Python standard-library module + src/latch/types/__init__.py:1:1: A005 Module `types` shadows a Python standard-library module
zulip/zulip (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ zerver/webhooks/json/__init__.py:1:1: A005 Module `json` shadows a Python standard-library module
Changes by rule (1 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| A005 | 34 | 26 | 8 | 0 | 0 |
MichaReiser
approved these changes
Feb 7, 2025
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks for taking the time to split this into its own PR!
crates/ruff_linter/src/rules/flake8_builtins/rules/stdlib_module_shadowing.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Micha Reiser <[email protected]>
Contributor
Author
|
I just did a manual |
ntBre
added a commit
that referenced
this pull request
Feb 26, 2025
Summary -- This resolves a TODO I left behind in #16006 now that our MSRV is 1.83. Test Plan -- Existing tests
ntBre
added a commit
that referenced
this pull request
Feb 26, 2025
Summary -- This resolves a TODO I left behind in #16006 now that our MSRV is 1.83. Test Plan -- Existing tests
ntBre
added a commit
that referenced
this pull request
Mar 11, 2025
## Summary This PR changes the default value of `lint.flake8-builtins.builtins-strict-checking` added in #15951 from `true` to `false`. This also allows simplifying the default option logic and removes the dependence on preview mode. #15399 was already closed by #15951, but this change will finalize the behavior mentioned in #15399 (comment). 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.
MichaReiser
pushed a commit
that referenced
this pull request
Mar 13, 2025
## Summary This PR changes the default value of `lint.flake8-builtins.builtins-strict-checking` added in #15951 from `true` to `false`. This also allows simplifying the default option logic and removes the dependence on preview mode. #15399 was already closed by #15951, but this change will finalize the behavior mentioned in #15399 (comment). 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.
MichaReiser
pushed a commit
that referenced
this pull request
Mar 13, 2025
## Summary This PR changes the default value of `lint.flake8-builtins.builtins-strict-checking` added in #15951 from `true` to `false`. This also allows simplifying the default option logic and removes the dependence on preview mode. #15399 was already closed by #15951, but this change will finalize the behavior mentioned in #15399 (comment). 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #15951 for the original discussion and reviews. This is just the first half of that PR (reaching parity with
flake8-builtinswithout adding any new configuration options) split out for nicer changelog entries.For posterity, here's a script for generating the module structure that was useful for interactive testing and creating the table here. The results for this branch are the same as the
Strictcolumn there, as expected.