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

[pylint] Exclude self and cls when counting method arguments #9563

Merged
merged 2 commits into from Jan 18, 2024

Conversation

tmke8
Copy link
Contributor

@tmke8 tmke8 commented Jan 17, 2024

closes #9552

Summary

This PR detects whether PLR0917 is being applied to a method or class method, and if so, it ignores the first argument for the purposes of counting the number of positional arguments.

Test Plan

New tests have been added to the corresponding fixture.

Copy link

codspeed-hq bot commented Jan 17, 2024

CodSpeed Performance Report

Merging #9563 will not alter performance

Comparing tmke8:positional-exclude-self-cls (53ee98a) with main (29c130f)

Summary

✅ 30 untouched benchmarks

Copy link
Contributor

github-actions bot commented Jan 17, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+1355 -2029 violations, +0 -0 fixes in 10 projects; 33 projects unchanged)

aiven/aiven-client (+20 -32 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

- aiven/client/argx.py:316:9: PLR0917 Too many positional arguments (10/5)
+ aiven/client/argx.py:316:9: PLR0917 Too many positional arguments (9/5)
- aiven/client/cli.py:3633:9: PLR0917 Too many positional arguments (6/5)
- aiven/client/cli.py:5697:9: PLR0917 Too many positional arguments (6/5)
- aiven/client/client.py:1080:9: PLR0917 Too many positional arguments (6/5)
- aiven/client/client.py:1090:9: PLR0917 Too many positional arguments (6/5)
- aiven/client/client.py:1166:9: PLR0917 Too many positional arguments (10/5)
+ aiven/client/client.py:1166:9: PLR0917 Too many positional arguments (9/5)
+ aiven/client/client.py:1206:9: PLR0917 Too many positional arguments (6/5)
- aiven/client/client.py:1206:9: PLR0917 Too many positional arguments (7/5)
... 42 additional changes omitted for project

apache/airflow (+780 -1077 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview --select ALL

- airflow/api/client/api_client.py:33:9: PLR0917 Too many positional arguments (6/5)
- airflow/api/client/json_client.py:57:9: PLR0917 Too many positional arguments (6/5)
- airflow/api/client/local_client.py:31:9: PLR0917 Too many positional arguments (6/5)
+ airflow/callbacks/callback_requests.py:114:9: PLR0917 Too many positional arguments (6/5)
- airflow/callbacks/callback_requests.py:114:9: PLR0917 Too many positional arguments (7/5)
- airflow/callbacks/callback_requests.py:76:9: PLR0917 Too many positional arguments (6/5)
+ airflow/cli/cli_config.py:79:9: PLR0917 Too many positional arguments (10/5)
- airflow/cli/cli_config.py:79:9: PLR0917 Too many positional arguments (11/5)
+ airflow/cli/commands/webserver_command.py:84:9: PLR0917 Too many positional arguments (6/5)
- airflow/cli/commands/webserver_command.py:84:9: PLR0917 Too many positional arguments (7/5)
+ airflow/configuration.py:1050:9: PLR0917 Too many positional arguments (6/5)
- airflow/configuration.py:1050:9: PLR0917 Too many positional arguments (7/5)
+ airflow/configuration.py:1071:9: PLR0917 Too many positional arguments (6/5)
- airflow/configuration.py:1071:9: PLR0917 Too many positional arguments (7/5)
+ airflow/configuration.py:1092:9: PLR0917 Too many positional arguments (7/5)
- airflow/configuration.py:1092:9: PLR0917 Too many positional arguments (8/5)
+ airflow/configuration.py:1114:9: PLR0917 Too many positional arguments (6/5)
- airflow/configuration.py:1114:9: PLR0917 Too many positional arguments (7/5)
+ airflow/configuration.py:1366:9: PLR0917 Too many positional arguments (6/5)
- airflow/configuration.py:1366:9: PLR0917 Too many positional arguments (7/5)
+ airflow/configuration.py:550:9: PLR0917 Too many positional arguments (10/5)
- airflow/configuration.py:550:9: PLR0917 Too many positional arguments (11/5)
+ airflow/configuration.py:609:9: PLR0917 Too many positional arguments (6/5)
- airflow/configuration.py:609:9: PLR0917 Too many positional arguments (7/5)
+ airflow/configuration.py:636:9: PLR0917 Too many positional arguments (11/5)
- airflow/configuration.py:636:9: PLR0917 Too many positional arguments (12/5)
+ airflow/dag_processing/manager.py:119:9: PLR0917 Too many positional arguments (6/5)
... 1830 additional changes omitted for project

aws/aws-sam-cli (+207 -318 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

- samcli/cli/global_config.py:184:9: PLR0917 Too many positional arguments (6/5)
- samcli/cli/global_config.py:223:9: PLR0917 Too many positional arguments (6/5)
+ samcli/commands/delete/delete_context.py:32:9: PLR0917 Too many positional arguments (8/5)
- samcli/commands/delete/delete_context.py:32:9: PLR0917 Too many positional arguments (9/5)
+ samcli/commands/deploy/deploy_context.py:183:9: PLR0917 Too many positional arguments (14/5)
- samcli/commands/deploy/deploy_context.py:183:9: PLR0917 Too many positional arguments (15/5)
+ samcli/commands/deploy/deploy_context.py:51:9: PLR0917 Too many positional arguments (24/5)
- samcli/commands/deploy/deploy_context.py:51:9: PLR0917 Too many positional arguments (25/5)
- samcli/commands/deploy/guided_config.py:51:9: PLR0917 Too many positional arguments (6/5)
+ samcli/commands/deploy/guided_context.py:318:9: PLR0917 Too many positional arguments (6/5)
... 515 additional changes omitted for project

bokeh/bokeh (+13 -25 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview --select ALL

- src/bokeh/client/connection.py:85:9: PLR0917 Too many positional arguments (6/5)
- src/bokeh/client/session.py:273:9: PLR0917 Too many positional arguments (6/5)
- src/bokeh/core/property/wrappers.py:438:9: PLR0917 Too many positional arguments (6/5)
+ src/bokeh/document/callbacks.py:223:9: PLR0917 Too many positional arguments (7/5)
- src/bokeh/document/callbacks.py:223:9: PLR0917 Too many positional arguments (8/5)
- src/bokeh/document/events.py:258:9: PLR0917 Too many positional arguments (6/5)
+ src/bokeh/document/events.py:290:9: PLR0917 Too many positional arguments (6/5)
- src/bokeh/document/events.py:290:9: PLR0917 Too many positional arguments (7/5)
+ src/bokeh/document/events.py:387:9: PLR0917 Too many positional arguments (7/5)
- src/bokeh/document/events.py:387:9: PLR0917 Too many positional arguments (8/5)
... 28 additional changes omitted for project

freedomofpress/securedrop (+8 -11 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ securedrop/journalist_app/sessions.py:100:9: PLR0917 Too many positional arguments (6/5)
- securedrop/journalist_app/sessions.py:100:9: PLR0917 Too many positional arguments (7/5)
+ securedrop/models.py:425:9: PLR0917 Too many positional arguments (6/5)
- securedrop/models.py:425:9: PLR0917 Too many positional arguments (7/5)
- securedrop/models.py:78:9: PLR0917 Too many positional arguments (6/5)
- securedrop/pretty_bad_protocol/_meta.py:135:9: PLR0917 Too many positional arguments (10/5)
... 13 additional changes omitted for rule PLR0917
+ securedrop/pretty_bad_protocol/_meta.py:752:111: RUF100 [*] Unused blanket `noqa` directive
... 12 additional changes omitted for project

fronzbot/blinkpy (+4 -8 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ blinkpy/auth.py:160:15: PLR0917 Too many positional arguments (8/5)
- blinkpy/auth.py:160:15: PLR0917 Too many positional arguments (9/5)
- blinkpy/auth.py:25:9: PLR0917 Too many positional arguments (6/5)
+ blinkpy/blinkpy.py:322:15: PLR0917 Too many positional arguments (6/5)
- blinkpy/blinkpy.py:322:15: PLR0917 Too many positional arguments (7/5)
- blinkpy/blinkpy.py:392:15: PLR0917 Too many positional arguments (6/5)
+ blinkpy/sync_module.py:648:9: PLR0917 Too many positional arguments (6/5)
- blinkpy/sync_module.py:648:9: PLR0917 Too many positional arguments (7/5)
- tests/mock_responses.py:8:9: PLR0917 Too many positional arguments (6/5)
- tests/test_blinkpy.py:196:15: PLR0917 Too many positional arguments (6/5)
... 2 additional changes omitted for project

ibis-project/ibis (+28 -53 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ ibis/backends/base/sql/alchemy/__init__.py:138:9: PLR0917 Too many positional arguments (8/5)
- ibis/backends/base/sql/alchemy/__init__.py:138:9: PLR0917 Too many positional arguments (9/5)
- ibis/backends/base/sql/alchemy/__init__.py:72:9: PLR0917 Too many positional arguments (6/5)
+ ibis/backends/base/sql/compiler/query_builder.py:192:9: PLR0917 Too many positional arguments (14/5)
- ibis/backends/base/sql/compiler/query_builder.py:192:9: PLR0917 Too many positional arguments (15/5)
- ibis/backends/base/sql/compiler/select_builder.py:26:9: PLR0917 Too many positional arguments (6/5)
- ibis/backends/base/sql/compiler/translator.py:192:9: PLR0917 Too many positional arguments (6/5)
+ ibis/backends/base/sql/ddl.py:118:9: PLR0917 Too many positional arguments (8/5)
- ibis/backends/base/sql/ddl.py:118:9: PLR0917 Too many positional arguments (9/5)
+ ibis/backends/base/sql/ddl.py:168:9: PLR0917 Too many positional arguments (8/5)
... 71 additional changes omitted for project

pandas-dev/pandas (+253 -441 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

- asv_bench/benchmarks/groupby.py:490:9: PLR0917 Too many positional arguments (6/5)
- asv_bench/benchmarks/groupby.py:573:9: PLR0917 Too many positional arguments (6/5)
- asv_bench/benchmarks/groupby.py:576:9: PLR0917 Too many positional arguments (6/5)
+ asv_bench/benchmarks/rolling.py:108:9: PLR0917 Too many positional arguments (6/5)
- asv_bench/benchmarks/rolling.py:108:9: PLR0917 Too many positional arguments (7/5)
+ asv_bench/benchmarks/rolling.py:123:9: PLR0917 Too many positional arguments (6/5)
- asv_bench/benchmarks/rolling.py:123:9: PLR0917 Too many positional arguments (7/5)
- asv_bench/benchmarks/rolling.py:214:9: PLR0917 Too many positional arguments (6/5)
- asv_bench/benchmarks/rolling.py:219:9: PLR0917 Too many positional arguments (6/5)
+ asv_bench/benchmarks/rolling.py:241:9: PLR0917 Too many positional arguments (6/5)
... 684 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
PLR0917 3383 1354 2029 0 0
RUF100 1 1 0 0 0

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jan 18, 2024
@charliermarsh charliermarsh changed the title PLR0917: Ignore first argument in methods [pylint] Exclude self and cls when counting method arguments Jan 18, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) January 18, 2024 03:12
@charliermarsh charliermarsh merged commit 7be7066 into astral-sh:main Jan 18, 2024
16 checks passed
@tmke8 tmke8 deleted the positional-exclude-self-cls branch January 18, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PLR0917: should this exclude self and cls?
2 participants