Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flake8-builtins] Match upstream module name comparison (A005) #16006

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Feb 6, 2025

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.

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 Strict column there, as expected.

mkdir abc collections foobar urlparse

for i in */
do
	touch $i/__init__.py
done	

cp -r abc foobar collections/.
cp -r abc collections foobar/.

touch ruff.toml

touch foobar/logging.py

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 ntBre added bug Something isn't working rule Implementing or modifying a lint rule labels Feb 6, 2025
Copy link
Contributor

github-actions bot commented Feb 6, 2025

ruff-ecosystem results

Linter (stable)

ℹ️ 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 --no-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 --no-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)

+ 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 --no-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

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

@ntBre ntBre requested a review from MichaReiser February 6, 2025 23:04
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to split this into its own PR!

crates/ruff/tests/lint.rs Show resolved Hide resolved
crates/ruff/tests/lint.rs Show resolved Hide resolved
Co-authored-by: Micha Reiser <micha@reiser.io>
@ntBre
Copy link
Contributor Author

ntBre commented Feb 7, 2025

I just did a manual is_none_or to avoid any MSRV problems, and I'm currently leaning toward just leaving the tests as they are. Once this is merged, I will rebase my other PR onto it!

@ntBre ntBre merged commit d4a5772 into main Feb 7, 2025
21 checks passed
@ntBre ntBre deleted the brent/a005-bugfix branch February 7, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants