-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Ruff v0.5] Stabilise 15 pylint rules #12051
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR1704 | 36 | 36 | 0 | 0 | 0 |
PLR2044 | 10 | 10 | 0 | 0 | 0 |
PLC2401 | 9 | 9 | 0 | 0 | 0 |
RUF100 | 4 | 0 | 4 | 0 | 0 |
PLR1736 | 3 | 3 | 0 | 0 | 0 |
PLW0133 | 2 | 2 | 0 | 0 | 0 |
PLC2403 | 2 | 2 | 0 | 0 | 0 |
PLE0704 | 2 | 2 | 0 | 0 | 0 |
PLW0604 | 1 | 1 | 0 | 0 | 0 |
PLW0128 | 1 | 1 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+852 -852 violations, +0 -0 fixes in 12 projects; 1 project error; 37 projects unchanged)
aiven/aiven-client (+1 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- aiven/client/argx.py:111:57: PLR6201 Use a `set` literal when testing for membership + aiven/client/argx.py:111:57: PLR6201 Use a set literal when testing for membership
PlasmaPy/PlasmaPy (+67 -67 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- src/plasmapy/dispersion/analytical/mhd_waves_.py:121:26: PLR6201 Use a `set` literal when testing for membership + src/plasmapy/dispersion/analytical/mhd_waves_.py:121:26: PLR6201 Use a set literal when testing for membership - src/plasmapy/dispersion/analytical/mhd_waves_.py:131:30: PLR6201 Use a `set` literal when testing for membership + src/plasmapy/dispersion/analytical/mhd_waves_.py:131:30: PLR6201 Use a set literal when testing for membership - src/plasmapy/dispersion/analytical/stix_.py:192:24: PLR6201 Use a `set` literal when testing for membership + src/plasmapy/dispersion/analytical/stix_.py:192:24: PLR6201 Use a set literal when testing for membership ... 107 additional changes omitted for rule PLR6201 + src/plasmapy/dispersion/analytical/two_fluid_.py:316:9: PLC2401 Variable name `ω` contains a non-ASCII character - src/plasmapy/dispersion/analytical/two_fluid_.py:316:9: PLC2401 Variable name `ω` contains a non-ASCII character, consider renaming it + src/plasmapy/dispersion/numerical/kinetic_alfven_.py:234:9: PLC2401 Variable name `θ` contains a non-ASCII character - src/plasmapy/dispersion/numerical/kinetic_alfven_.py:234:9: PLC2401 Variable name `θ` contains a non-ASCII character, consider renaming it ... 124 additional changes omitted for project
apache/airflow (+327 -327 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- airflow/__init__.py:98:65: PLR6201 Use a `set` literal when testing for membership + airflow/__init__.py:98:65: PLR6201 Use a set literal when testing for membership - airflow/__main__.py:49:31: PLR6201 Use a `set` literal when testing for membership + airflow/__main__.py:49:31: PLR6201 Use a set literal when testing for membership - airflow/__main__.py:56:31: PLR6201 Use a `set` literal when testing for membership + airflow/__main__.py:56:31: PLR6201 Use a set literal when testing for membership - airflow/api_connexion/endpoints/task_instance_endpoint.py:277:26: PLR6201 Use a `set` literal when testing for membership + airflow/api_connexion/endpoints/task_instance_endpoint.py:277:26: PLR6201 Use a set literal when testing for membership - airflow/api_connexion/endpoints/task_instance_endpoint.py:729:20: PLR6201 Use a `set` literal when testing for membership + airflow/api_connexion/endpoints/task_instance_endpoint.py:729:20: PLR6201 Use a set literal when testing for membership ... 639 additional changes omitted for rule PLR6201 + dev/breeze/src/airflow_breeze/utils/parallel.py:297:57: PLR1736 [*] List index lookup in `enumerate()` loop - dev/breeze/src/airflow_breeze/utils/parallel.py:297:57: PLR1736 [*] Unnecessary lookup of list item by index + dev/breeze/src/airflow_breeze/utils/parallel.py:299:40: PLR1736 [*] List index lookup in `enumerate()` loop - dev/breeze/src/airflow_breeze/utils/parallel.py:299:40: PLR1736 [*] Unnecessary lookup of list item by index + scripts/ci/pre_commit/check_provider_airflow_compatibility.py:51:20: PLR1736 [*] List index lookup in `enumerate()` loop - scripts/ci/pre_commit/check_provider_airflow_compatibility.py:51:20: PLR1736 [*] Unnecessary lookup of list item by index ... 638 additional changes omitted for project
aws/aws-sam-cli (+42 -42 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- samcli/cli/main.py:89:27: PLR6201 Use a `set` literal when testing for membership + samcli/cli/main.py:89:27: PLR6201 Use a set literal when testing for membership - samcli/cli/types.py:58:56: PLR6201 Use a `set` literal when testing for membership + samcli/cli/types.py:58:56: PLR6201 Use a set literal when testing for membership - samcli/cli/types.py:58:84: PLR6201 Use a `set` literal when testing for membership + samcli/cli/types.py:58:84: PLR6201 Use a set literal when testing for membership - samcli/commands/_utils/custom_options/hook_name_option.py:46:28: PLR6201 Use a `set` literal when testing for membership + samcli/commands/_utils/custom_options/hook_name_option.py:46:28: PLR6201 Use a set literal when testing for membership - samcli/commands/_utils/template.py:162:34: PLR6201 Use a `set` literal when testing for membership + samcli/commands/_utils/template.py:162:34: PLR6201 Use a set literal when testing for membership ... 74 additional changes omitted for project
bokeh/bokeh (+28 -28 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
- examples/output/apis/file_html.py:39:48: PLR6201 Use a `set` literal when testing for membership + examples/output/apis/file_html.py:39:48: PLR6201 Use a set literal when testing for membership - examples/plotting/sprint.py:23:48: PLR6201 Use a `set` literal when testing for membership + examples/plotting/sprint.py:23:48: PLR6201 Use a set literal when testing for membership - release/checks.py:69:30: PLR6201 Use a `set` literal when testing for membership + release/checks.py:69:30: PLR6201 Use a set literal when testing for membership - src/bokeh/__init__.py:104:24: PLR6201 Use a `set` literal when testing for membership + src/bokeh/__init__.py:104:24: PLR6201 Use a set literal when testing for membership - src/bokeh/command/subcommands/__init__.py:56:48: PLR6201 Use a `set` literal when testing for membership + src/bokeh/command/subcommands/__init__.py:56:48: PLR6201 Use a set literal when testing for membership ... 46 additional changes omitted for project
freedomofpress/securedrop (+40 -40 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- devops/scripts/verify-mo.py:140:35: PLR6201 Use a `set` literal when testing for membership + devops/scripts/verify-mo.py:140:35: PLR6201 Use a set literal when testing for membership - molecule/ansible-config/tests/test_play_configuration.py:34:25: PLR6201 Use a `set` literal when testing for membership + molecule/ansible-config/tests/test_play_configuration.py:34:25: PLR6201 Use a set literal when testing for membership - securedrop/manage.py:170:22: PLR6201 Use a `set` literal when testing for membership + securedrop/manage.py:170:22: PLR6201 Use a set literal when testing for membership - securedrop/manage.py:172:24: PLR6201 Use a `set` literal when testing for membership + securedrop/manage.py:172:24: PLR6201 Use a set literal when testing for membership - securedrop/pretty_bad_protocol/_parsers.py:1057:25: PLR6201 Use a `set` literal when testing for membership + securedrop/pretty_bad_protocol/_parsers.py:1057:25: PLR6201 Use a set literal when testing for membership ... 70 additional changes omitted for project
fronzbot/blinkpy (+3 -3 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- blinkpy/auth.py:150:35: PLR6201 Use a `set` literal when testing for membership + blinkpy/auth.py:150:35: PLR6201 Use a set literal when testing for membership - blinkpy/camera.py:144:41: PLR6201 Use a `set` literal when testing for membership + blinkpy/camera.py:144:41: PLR6201 Use a set literal when testing for membership - blinkpy/camera.py:157:25: PLR6201 Use a `set` literal when testing for membership + blinkpy/camera.py:157:25: PLR6201 Use a set literal when testing for membership
ibis-project/ibis (+61 -61 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- ibis/backends/__init__.py:1378:18: PLR6201 Use a `set` literal when testing for membership + ibis/backends/__init__.py:1378:18: PLR6201 Use a set literal when testing for membership - ibis/backends/bigquery/compiler.py:609:23: PLR6201 Use a `set` literal when testing for membership + ibis/backends/bigquery/compiler.py:609:23: PLR6201 Use a set literal when testing for membership - ibis/backends/bigquery/compiler.py:635:23: PLR6201 Use a `set` literal when testing for membership + ibis/backends/bigquery/compiler.py:635:23: PLR6201 Use a set literal when testing for membership - ibis/backends/bigquery/tests/system/test_client.py:308:22: PLR6201 Use a `set` literal when testing for membership + ibis/backends/bigquery/tests/system/test_client.py:308:22: PLR6201 Use a set literal when testing for membership - ibis/backends/clickhouse/compiler.py:269:32: PLR6201 Use a `set` literal when testing for membership + ibis/backends/clickhouse/compiler.py:269:32: PLR6201 Use a set literal when testing for membership ... 112 additional changes omitted for project
milvus-io/pymilvus (+42 -42 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
- pymilvus/bulk_writer/remote_bulk_writer.py:282:31: PLR6201 Use a `set` literal when testing for membership + pymilvus/bulk_writer/remote_bulk_writer.py:282:31: PLR6201 Use a set literal when testing for membership - pymilvus/client/abstract.py:443:25: PLR6201 Use a `set` literal when testing for membership + pymilvus/client/abstract.py:443:25: PLR6201 Use a set literal when testing for membership - pymilvus/client/abstract.py:553:39: PLR6201 Use a `set` literal when testing for membership + pymilvus/client/abstract.py:553:39: PLR6201 Use a set literal when testing for membership - pymilvus/client/abstract.py:560:43: PLR6201 Use a `set` literal when testing for membership + pymilvus/client/abstract.py:560:43: PLR6201 Use a set literal when testing for membership - pymilvus/client/abstract.py:562:45: PLR6201 Use a `set` literal when testing for membership + pymilvus/client/abstract.py:562:45: PLR6201 Use a set literal when testing for membership ... 74 additional changes omitted for project
... Truncated remaining completed project reports due to GitHub comment length restrictions
demisto/content (error)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`:
- 'ignore' -> 'lint.ignore'
- 'select' -> 'lint.select'
- 'unfixable' -> 'lint.unfixable'
- 'per-file-ignores' -> 'lint.per-file-ignores'
warning: `PGH001` has been remapped to `S307`.
warning: `PGH002` has been remapped to `G010`.
warning: `PLR1701` has been remapped to `SIM101`.
ruff failed
Cause: Selection of deprecated rule `E999` is not allowed when preview is enabled.
Changes by rule (4 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR6201 | 1676 | 838 | 838 | 0 | 0 |
PLC2401 | 18 | 9 | 9 | 0 | 0 |
PLR1736 | 6 | 3 | 3 | 0 | 0 |
PLC2403 | 4 | 2 | 2 | 0 | 0 |
873f9bf
to
896516c
Compare
Are you sure that PLR6201 is really useful rule? I believe initializing set for only one operation is too expensive and has no sense. I would prefer using tuple. And if the reason is to avoid duplicating items maybe it's better to have the rule which checks such items instead? |
Thanks @airreality. While I think it's a useful rule, and probably one that I would enable on my own projects, I agree that there's a lot of ecosystem hits for PLR6201. The performance pros and cons have already been discussed in some depth in #8758 and #9604; however, I missed that #8322 regarding this rule is still open. I think it'd be inappropriate to stabilise a rule while there's still open issues about its behaviour, so I'll axe that rule from the list. I'm also slightly concerned about the number of hits for |
48aa05a
to
a313eae
Compare
83ccd9a
to
da00351
Compare
Summary
Stabilise the following rules:
bad-open-mode
(PLW1501
)empty-comment
(PLR2044
)global-at-module-level
(PLW0604
)literal-membership
(PLR6201
)misplaced-bare-raise
(PLE0704
)nan-comparison
(PLW0177
)non-ascii-import-name
(PLC2403
)non-ascii-name
(PLC2401
)nonlocal-and-global
(PLE0115
)potential-index-error
(PLE0643
)redeclared-assigned-name
(PLW0128
)redefined-argument-from-locals
(PLR1704
)repeated-keyword-argument
(PLE1132
)super-without-brackets
(PLW0245
)unnecessary-list-index-lookup
(PLR1736
)useless-exception-statement
(PLW0133
)useless-with-lock
(PLW2101
)These rules have all been in preview for over 3 months; there are no open issues about them, and there haven't been issues about them for months; and their recommendations seem pretty sane and uncontroversial. For some of them, the docs or messages to the user were slightly suboptimal; I've made a few touch-ups as part of this PR.
Many other pylint rules have somewhat opinionated or controversial changes; this PR deliberately leaves quite a few pylint rules still in
preview
.Test Plan
cargo test
, but the ecosystem check will be the real judge...