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] Implement too-many-positional (PLR0917) #8995

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

flying-sheep
Copy link
Contributor

Summary

Adds a rule that bans too many positional (i.e. not keyword-only) parameters in function definitions.

Fixes #8946

Rule ID code taken from pylint-dev/pylint#9278

Test Plan

  1. fixtures file checking multiple OKs/fails
  2. parametrized test file

@charliermarsh charliermarsh self-requested a review December 4, 2023 15:17
@charliermarsh charliermarsh added rule Implementing or modifying a lint rule preview Related to preview mode features labels Dec 4, 2023
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Looks good to me, just gonna tweak a bit before merging. This'll go out later today.

@charliermarsh charliermarsh changed the title Add too-many-positional rule [pylint] Implement too-many-positional (PLR0917) Dec 4, 2023
@charliermarsh charliermarsh force-pushed the add-too-many-positional branch 2 times, most recently from 46097ba to 372e369 Compare December 4, 2023 17:57
@charliermarsh charliermarsh enabled auto-merge (squash) December 4, 2023 17:57
@charliermarsh charliermarsh merged commit b90027d into astral-sh:main Dec 4, 2023
16 checks passed
Copy link
Contributor

github-actions bot commented Dec 4, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+3176 -1 violations, +0 -0 fixes in 41 projects)

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

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

+ aiven/client/argx.py:311:9: PLR0917 Too many positional arguments: (10/5)
+ aiven/client/cli.py:3724:9: PLR0917 Too many positional arguments: (6/5)
+ aiven/client/cli.py:5717:9: PLR0917 Too many positional arguments: (6/5)
+ aiven/client/client.py:1062:9: PLR0917 Too many positional arguments: (6/5)
+ aiven/client/client.py:1072:9: PLR0917 Too many positional arguments: (6/5)
+ aiven/client/client.py:1148:9: PLR0917 Too many positional arguments: (10/5)
+ aiven/client/client.py:1188:9: PLR0917 Too many positional arguments: (7/5)
+ aiven/client/client.py:1213:9: PLR0917 Too many positional arguments: (7/5)
+ aiven/client/client.py:1298:9: PLR0917 Too many positional arguments: (12/5)
+ aiven/client/client.py:1334:9: PLR0917 Too many positional arguments: (13/5)
... 22 additional changes omitted for project

apache/airflow (+1169 -0 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/api/common/mark_tasks.py:209:5: PLR0917 Too many positional arguments: (6/5)
+ airflow/api/common/trigger_dag.py:34:5: PLR0917 Too many positional arguments: (6/5)
+ airflow/api_connexion/endpoints/dag_endpoint.py:144:5: PLR0917 Too many positional arguments: (7/5)
+ airflow/auth/managers/fab/security_manager/override.py:1437:9: PLR0917 Too many positional arguments: (8/5)
+ airflow/auth/managers/fab/security_manager/override.py:1480:9: PLR0917 Too many positional arguments: (7/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: (11/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: (7/5)
+ airflow/configuration.py:1071: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: (7/5)
+ airflow/configuration.py:1366:9: PLR0917 Too many positional arguments: (7/5)
+ airflow/configuration.py:1599:9: PLR0917 Too many positional arguments: (9/5)
... 1151 additional changes omitted for project

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

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

+ samcli/cli/cli_config_file.py:176:5: PLR0917 Too many positional arguments: (7/5)
+ samcli/cli/global_config.py:150:9: PLR0917 Too many positional arguments: (6/5)
+ samcli/cli/global_config.py:162:9: PLR0917 Too many positional arguments: (6/5)
+ samcli/cli/global_config.py:174:9: PLR0917 Too many positional arguments: (6/5)
+ 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/_utils/options.py:184:5: PLR0917 Too many positional arguments: (6/5)
+ samcli/commands/_utils/table_print.py:103:5: PLR0917 Too many positional arguments: (7/5)
+ samcli/commands/_utils/table_print.py:15:5: PLR0917 Too many positional arguments: (6/5)
+ samcli/commands/delete/command.py:119:5: PLR0917 Too many positional arguments: (8/5)
... 381 additional changes omitted for project

bokeh/bokeh (+54 -0 violations, +0 -0 fixes)

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

+ examples/basic/annotations/colorbar_log.py:15:5: PLR0917 Too many positional arguments: (6/5)
+ examples/models/gauges.py:48:5: PLR0917 Too many positional arguments: (7/5)
+ examples/plotting/histogram.py:17:5: PLR0917 Too many positional arguments: (6/5)
+ examples/topics/hierarchical/treemap.py:26:5: PLR0917 Too many positional arguments: (6/5)
+ src/bokeh/client/session.py:194:5: 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: (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: (7/5)
... 44 additional changes omitted for project

freedomofpress/securedrop (+15 -1 violations, +0 -0 fixes)

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

+ securedrop/journalist_app/sessions.py:100:9: PLR0917 Too many positional arguments: (7/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)
- securedrop/pretty_bad_protocol/_meta.py:752:111: RUF100 [*] Unused blanket `noqa` directive
+ securedrop/pretty_bad_protocol/_meta.py:785:9: PLR0917 Too many positional arguments: (8/5)
+ securedrop/pretty_bad_protocol/_meta.py:857:9: PLR0917 Too many positional arguments: (15/5)
... 10 additional changes omitted for rule PLR0917
... 9 additional changes omitted for project

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

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

+ blinkpy/api.py:461:11: PLR0917 Too many positional arguments: (6/5)
+ blinkpy/api.py:483:11: PLR0917 Too many positional arguments: (6/5)
+ blinkpy/auth.py:144:15: PLR0917 Too many positional arguments: (9/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:639:9: PLR0917 Too many positional arguments: (7/5)
+ tests/test_blinkpy.py:196:15: PLR0917 Too many positional arguments: (6/5)
+ tests/test_blinkpy.py:543:15: PLR0917 Too many positional arguments: (8/5)

ibis-project/ibis (+103 -0 violations, +0 -0 fixes)

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

+ ibis/backends/base/sql/alchemy/__init__.py:139:9: PLR0917 Too many positional arguments: (8/5)
+ ibis/backends/base/sql/alchemy/__init__.py:73:9: PLR0917 Too many positional arguments: (6/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: (9/5)
+ ibis/backends/base/sql/ddl.py:168:9: PLR0917 Too many positional arguments: (9/5)
+ ibis/backends/base/sql/ddl.py:325:9: PLR0917 Too many positional arguments: (7/5)
+ ibis/backends/base/sql/ddl.py:361:9: PLR0917 Too many positional arguments: (6/5)
+ ibis/backends/base/sql/ddl.py:405:9: PLR0917 Too many positional arguments: (6/5)
... 93 additional changes omitted for project

milvus-io/pymilvus (+38 -0 violations, +0 -0 fixes)

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

+ pymilvus/bulk_writer/bulk_import.py:79:5: PLR0917 Too many positional arguments: (7/5)
+ pymilvus/bulk_writer/remote_bulk_writer.py:36:13: PLR0917 Too many positional arguments: (10/5)
+ pymilvus/bulk_writer/remote_bulk_writer.py:58:9: PLR0917 Too many positional arguments: (6/5)
+ pymilvus/client/abstract.py:389:9: PLR0917 Too many positional arguments: (6/5)
+ pymilvus/client/grpc_handler.py:1281:9: PLR0917 Too many positional arguments: (6/5)
+ pymilvus/client/grpc_handler.py:1295:9: PLR0917 Too many positional arguments: (6/5)
+ pymilvus/client/grpc_handler.py:1338:9: PLR0917 Too many positional arguments: (6/5)
+ pymilvus/client/grpc_handler.py:1595:9: PLR0917 Too many positional arguments: (7/5)
+ pymilvus/client/grpc_handler.py:1617:9: PLR0917 Too many positional arguments: (7/5)
+ pymilvus/client/grpc_handler.py:1648:9: PLR0917 Too many positional arguments: (6/5)
... 28 additional changes omitted for project

pandas-dev/pandas (+694 -0 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: (7/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: (7/5)
+ asv_bench/benchmarks/rolling.py:246:9: PLR0917 Too many positional arguments: (7/5)
+ asv_bench/benchmarks/rolling.py:41:9: PLR0917 Too many positional arguments: (6/5)
... 684 additional changes omitted for project

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

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
PLR0917 3176 3176 0 0 0
RUF100 1 0 1 0 0

@flying-sheep flying-sheep deleted the add-too-many-positional branch December 5, 2023 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add rule “too many positional arguments in function definition”
2 participants