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] Default to non-strict checking (A005) #16125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Feb 12, 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.

@ntBre ntBre added breaking Breaking API change configuration Related to settings and configuration labels Feb 12, 2025
@ntBre ntBre added this to the v0.10 milestone Feb 12, 2025
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -104 violations, +0 -0 fixes in 6 projects; 49 projects unchanged)

Snowflake-Labs/snowcli (+0 -7 violations, +0 -0 fixes)

- src/snowflake/cli/_plugins/cortex/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- src/snowflake/cli/_plugins/notebook/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- src/snowflake/cli/api/console/abc.py:1:1: A005 Module `abc` shadows a Python standard-library module
- src/snowflake/cli/api/console/enum.py:1:1: A005 Module `enum` shadows a Python standard-library module
- src/snowflake/cli/api/errno.py:1:1: A005 Module `errno` shadows a Python standard-library module
- src/snowflake/cli/api/output/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- src/snowflake/cli/api/utils/types.py:1:1: A005 Module `types` shadows a Python standard-library module

apache/airflow (+0 -48 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

- airflow/api_connexion/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- airflow/api_fastapi/common/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- airflow/api_fastapi/execution_api/datamodels/token.py:1:1: A005 Module `token` shadows a Python standard-library module
- 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/io/utils/stat.py:1:1: A005 Module `stat` shadows a Python standard-library module
- airflow/models/operator.py:1:1: A005 Module `operator` shadows a Python standard-library module
- airflow/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module
- airflow/serialization/serializers/datetime.py:1:1: A005 Module `datetime` shadows a Python standard-library module
- airflow/utils/email.py:1:1: A005 Module `email` shadows a Python standard-library module
- airflow/utils/json.py:1:1: A005 Module `json` shadows a Python standard-library module
- airflow/utils/platform.py:1:1: A005 Module `platform` shadows a Python standard-library module
- airflow/utils/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- airflow/utils/warnings.py:1:1: A005 Module `warnings` shadows a Python standard-library module
- providers/amazon/src/airflow/providers/amazon/aws/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module
- providers/amazon/tests/provider_tests/amazon/aws/secrets/__init__.py:1:1: A005 Module `secrets` shadows a Python standard-library module
- providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/resource.py:1:1: A005 Module `resource` shadows a Python standard-library module
- providers/common/io/src/airflow/providers/common/io/__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/common/io/tests/system/common/io/__init__.py:1:1: A005 Module `io` shadows a Python standard-library module
- providers/fab/src/airflow/providers/fab/www/api_connexion/types.py:1:1: A005 Module `types` 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/src/airflow/providers/google/suite/hooks/calendar.py:1:1: A005 Module `calendar` shadows a Python standard-library module
... 25 additional changes omitted for project

apache/superset (+0 -15 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

- superset/advanced_data_type/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- superset/commands/dashboard/copy.py:1:1: A005 Module `copy` shadows a Python standard-library module
- superset/dashboards/permalink/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- superset/databases/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- superset/distributed_lock/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- superset/explore/permalink/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- superset/key_value/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- superset/reports/notifications/email.py:1:1: A005 Module `email` shadows a Python standard-library module
- superset/reports/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- superset/sqllab/permalink/types.py:1:1: A005 Module `types` shadows a Python standard-library module
... 5 additional changes omitted for project

bokeh/bokeh (+0 -17 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/application/handlers/code.py:1:1: A005 Module `code` shadows a Python standard-library module
- src/bokeh/command/subcommands/json.py:1:1: A005 Module `json` shadows a Python standard-library module
- src/bokeh/core/property/datetime.py:1:1: A005 Module `datetime` shadows a Python standard-library module
- src/bokeh/core/property/enum.py:1:1: A005 Module `enum` shadows a Python standard-library module
- src/bokeh/core/property/json.py:1:1: A005 Module `json` shadows a Python standard-library module
- src/bokeh/core/property/string.py:1:1: A005 Module `string` shadows a Python standard-library module
- src/bokeh/core/property/struct.py:1:1: A005 Module `struct` shadows a Python standard-library module
- src/bokeh/core/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- src/bokeh/core/validation/warnings.py:1:1: A005 Module `warnings` shadows a Python standard-library module
... 7 additional changes omitted for project

latchbio/latch (+0 -10 violations, +0 -0 fixes)

- src/latch/functions/secrets.py:1:1: A005 Module `secrets` shadows a Python standard-library module
- src/latch/idl/core/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- src/latch/registry/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- src/latch/registry/upstream_types/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
- src/latch/types/glob.py:1:1: A005 Module `glob` shadows a Python standard-library module
- src/latch/types/json.py:1:1: A005 Module `json` shadows a Python standard-library module
- src/latch_cli/exceptions/traceback.py:1:1: A005 Module `traceback` shadows a Python standard-library module
- src/latch_cli/services/cp/glob.py:1:1: A005 Module `glob` shadows a Python standard-library module
- src/latch_cli/snakemake/config/parser.py:1:1: A005 Module `parser` shadows a Python standard-library module

zulip/zulip (+0 -7 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --no-preview --select ALL

- zerver/actions/typing.py:1:1: A005 Module `typing` shadows a Python standard-library module
- zerver/lib/profile.py:1:1: A005 Module `profile` shadows a Python standard-library module
- zerver/lib/queue.py:1:1: A005 Module `queue` shadows a Python standard-library module
- zerver/lib/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- zerver/lib/url_preview/types.py:1:1: A005 Module `types` shadows a Python standard-library module
- zerver/views/typing.py:1:1: A005 Module `typing` shadows a Python standard-library module
- 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 104 0 104 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser
Copy link
Member

Did you look through the ecosystem check?

We'll have to wait with merging this until the 0.10 release.

@ntBre
Copy link
Contributor Author

ntBre commented Feb 13, 2025

I just looked through the ecosystem check and it looks like what I expected. There are a lot of deeply nested types and json modules that are no longer marked as errors. And there are no new violations, which is as expected too.

I labeled with breaking and added to the 0.10 milestone. Should I mark it as a draft to prevent merging too?

@MichaReiser MichaReiser added the do-not-merge Do not merge this pull request label Feb 13, 2025
@MichaReiser
Copy link
Member

It should be fine. I added the do-not-merge label to it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API change configuration Related to settings and configuration do-not-merge Do not merge this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants