Skip to content
New issue

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

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

Already on GitHub? # to your account

PLR0203: Delete entire statement, including semicolons #10074

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

sanxiyn
Copy link
Contributor

@sanxiyn sanxiyn commented Feb 21, 2024

Fix for #8402 (comment).

Copy link
Contributor

github-actions bot commented Feb 21, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -768 violations, +0 -0 fixes in 11 projects; 32 projects unchanged)

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

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

- airflow/cli/commands/webserver_command.py:48:7: PLR0902 Too many instance attributes (11/7)
- airflow/dag_processing/manager.py:330:7: PLR0902 Too many instance attributes (23/7)
- airflow/dag_processing/manager.py:99:7: PLR0902 Too many instance attributes (10/7)
- airflow/dag_processing/processor.py:69:7: PLR0902 Too many instance attributes (10/7)
- airflow/jobs/backfill_job_runner.py:65:7: PLR0902 Too many instance attributes (17/7)
- airflow/jobs/job.py:58:7: PLR0902 Too many instance attributes (11/7)
- airflow/jobs/local_task_job_runner.py:77:7: PLR0902 Too many instance attributes (13/7)
- airflow/jobs/scheduler_job_runner.py:129:7: PLR0902 Too many instance attributes (11/7)
- airflow/models/baseoperator.py:475:7: PLR0902 Too many instance attributes (38/7)
- airflow/models/connection.py:97:7: PLR0902 Too many instance attributes (8/7)
- airflow/models/dag.py:302:7: PLR0902 Too many instance attributes (30/7)
- airflow/models/dagrun.py:110:7: PLR0902 Too many instance attributes (13/7)
- airflow/models/taskinstance.py:1210:7: PLR0902 Too many instance attributes (20/7)
- airflow/models/taskinstance.py:3503:7: PLR0902 Too many instance attributes (14/7)
- airflow/models/taskreschedule.py:44:7: PLR0902 Too many instance attributes (9/7)
- airflow/operators/email.py:29:7: PLR0902 Too many instance attributes (10/7)
- airflow/operators/trigger_dagrun.py:72:7: PLR0902 Too many instance attributes (8/7)
- airflow/providers/airbyte/operators/airbyte.py:33:7: PLR0902 Too many instance attributes (8/7)
- airflow/providers/amazon/aws/hooks/glue.py:33:7: PLR0902 Too many instance attributes (12/7)
- airflow/providers/amazon/aws/operators/appflow.py:45:7: PLR0902 Too many instance attributes (8/7)
- airflow/providers/amazon/aws/operators/athena.py:40:7: PLR0902 Too many instance attributes (11/7)
- airflow/providers/amazon/aws/operators/batch.py:428:7: PLR0902 Too many instance attributes (12/7)
- airflow/providers/amazon/aws/operators/batch.py:54:7: PLR0902 Too many instance attributes (22/7)
- airflow/providers/amazon/aws/operators/datasync.py:35:7: PLR0902 Too many instance attributes (20/7)
- airflow/providers/amazon/aws/operators/dms.py:30:7: PLR0902 Too many instance attributes (8/7)
- airflow/providers/amazon/aws/operators/ec2.py:122:7: PLR0902 Too many instance attributes (10/7)
- airflow/providers/amazon/aws/operators/ecs.py:355:7: PLR0902 Too many instance attributes (24/7)
- airflow/providers/amazon/aws/operators/eks.py:140:7: PLR0902 Too many instance attributes (18/7)
- airflow/providers/amazon/aws/operators/eks.py:434:7: PLR0902 Too many instance attributes (12/7)
- airflow/providers/amazon/aws/operators/eks.py:557:7: PLR0902 Too many instance attributes (12/7)
- airflow/providers/amazon/aws/operators/eks.py:669:7: PLR0902 Too many instance attributes (8/7)
- airflow/providers/amazon/aws/operators/eks.py:799:7: PLR0902 Too many instance attributes (8/7)
- airflow/providers/amazon/aws/operators/eks.py:890:7: PLR0902 Too many instance attributes (8/7)
- airflow/providers/amazon/aws/operators/emr.py:1002:7: PLR0902 Too many instance attributes (10/7)
- airflow/providers/amazon/aws/operators/emr.py:1169:7: PLR0902 Too many instance attributes (14/7)
- airflow/providers/amazon/aws/operators/emr.py:203:7: PLR0902 Too many instance attributes (13/7)
... 529 additional changes omitted for project

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

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

- samcli/commands/delete/delete_context.py:30:7: PLR0902 Too many instance attributes (14/7)
- samcli/commands/deploy/deploy_context.py:43:7: PLR0902 Too many instance attributes (27/7)
- samcli/commands/deploy/guided_context.py:42:7: PLR0902 Too many instance attributes (32/7)
- samcli/commands/list/endpoints/endpoints_context.py:16:7: PLR0902 Too many instance attributes (10/7)
- samcli/commands/local/cli_common/invoke_context.py:62:7: PLR0902 Too many instance attributes (31/7)
- samcli/commands/local/lib/local_api_service.py:15:7: PLR0902 Too many instance attributes (9/7)
- samcli/commands/local/lib/local_lambda.py:34:7: PLR0902 Too many instance attributes (10/7)
- samcli/commands/package/package_context.py:44:7: PLR0902 Too many instance attributes (18/7)
- samcli/commands/pipeline/bootstrap/guided_context.py:36:7: PLR0902 Too many instance attributes (16/7)
- samcli/lib/iac/plugins_interfaces.py:182:7: PLR0902 Too many instance attributes (8/7)
... 71 additional changes omitted for project

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

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

- src/bokeh/application/handlers/code_runner.py:53:7: PLR0902 Too many instance attributes (11/7)
- src/bokeh/client/connection.py:76:7: PLR0902 Too many instance attributes (11/7)
- src/bokeh/document/callbacks.py:86:7: PLR0902 Too many instance attributes (10/7)
- src/bokeh/document/document.py:111:7: PLR0902 Too many instance attributes (9/7)
- src/bokeh/models/util/structure.py:96:7: PLR0902 Too many instance attributes (10/7)
- src/bokeh/protocol/message.py:118:7: PLR0902 Too many instance attributes (10/7)
- src/bokeh/resources.py:264:7: PLR0902 Too many instance attributes (12/7)
- src/bokeh/server/contexts.py:144:7: PLR0902 Too many instance attributes (8/7)
- src/bokeh/server/session.py:122:7: PLR0902 Too many instance attributes (13/7)
- src/bokeh/server/tornado.py:97:7: PLR0902 Too many instance attributes (21/7)
... 3 additional changes omitted for project

freedomofpress/securedrop (+0 -10 violations, +0 -0 fixes)

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

- journalist_gui/journalist_gui/SecureDropUpdater.py:169:7: PLR0902 Too many instance attributes (8/7)
- journalist_gui/journalist_gui/updaterUI.py:10:7: PLR0902 Too many instance attributes (16/7)
- securedrop/journalist_app/sessions.py:18:7: PLR0902 Too many instance attributes (10/7)
- securedrop/journalist_app/sessions.py:83:7: PLR0902 Too many instance attributes (11/7)
- securedrop/pretty_bad_protocol/_meta.py:110:7: PLR0902 Too many instance attributes (14/7)
- securedrop/pretty_bad_protocol/_parsers.py:1172:7: PLR0902 Too many instance attributes (8/7)
- securedrop/pretty_bad_protocol/_parsers.py:1457:7: PLR0902 Too many instance attributes (17/7)
- securedrop/pretty_bad_protocol/_parsers.py:978:7: PLR0902 Too many instance attributes (8/7)
- securedrop/secure_tempfile.py:13:7: PLR0902 Too many instance attributes (9/7)
- securedrop/upload-screenshots.py:72:7: PLR0902 Too many instance attributes (9/7)

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

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

- blinkpy/auth.py:22:7: PLR0902 Too many instance attributes (12/7)
- blinkpy/blinkpy.py:41:7: PLR0902 Too many instance attributes (17/7)
- blinkpy/camera.py:19:7: PLR0902 Too many instance attributes (23/7)
- blinkpy/sync_module.py:23:7: PLR0902 Too many instance attributes (21/7)
- tests/mock_responses.py:5:7: PLR0902 Too many instance attributes (8/7)

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

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

- ibis/backends/bigquery/udf/core.py:105:7: PLR0902 Too many instance attributes (8/7)
- ibis/backends/flink/ddl.py:77:7: PLR0902 Too many instance attributes (10/7)
- ibis/backends/impala/ddl.py:73:7: PLR0902 Too many instance attributes (8/7)

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

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

- pymilvus/bulk_writer/bulk_writer.py:36:7: PLR0902 Too many instance attributes (8/7)
- pymilvus/bulk_writer/remote_bulk_writer.py:38:11: PLR0902 Too many instance attributes (9/7)
- pymilvus/client/abstract.py:14:7: PLR0902 Too many instance attributes (12/7)
- pymilvus/client/abstract.py:186:7: PLR0902 Too many instance attributes (8/7)
- pymilvus/client/abstract.py:99:7: PLR0902 Too many instance attributes (14/7)
- pymilvus/client/asynch.py:56:7: PLR0902 Too many instance attributes (11/7)
- pymilvus/client/grpc_handler.py:68:7: PLR0902 Too many instance attributes (17/7)
- pymilvus/orm/iterator.py:275:7: PLR0902 Too many instance attributes (12/7)
- pymilvus/orm/iterator.py:58:7: PLR0902 Too many instance attributes (11/7)
- pymilvus/orm/schema.py:250:7: PLR0902 Too many instance attributes (10/7)

pandas-dev/pandas (+0 -49 violations, +0 -0 fixes)

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

- asv_bench/benchmarks/categoricals.py:18:7: PLR0902 Too many instance attributes (12/7)
- asv_bench/benchmarks/io/hdf.py:14:7: PLR0902 Too many instance attributes (12/7)
- asv_bench/benchmarks/join_merge.py:367:7: PLR0902 Too many instance attributes (8/7)
- asv_bench/benchmarks/join_merge.py:427:7: PLR0902 Too many instance attributes (12/7)
- asv_bench/benchmarks/reindex.py:13:7: PLR0902 Too many instance attributes (8/7)
- pandas/core/apply.py:115:7: PLR0902 Too many instance attributes (9/7)
- pandas/core/groupby/groupby.py:1041:7: PLR0902 Too many instance attributes (11/7)
- pandas/core/groupby/grouper.py:454:7: PLR0902 Too many instance attributes (12/7)
- pandas/core/groupby/grouper.py:58:7: PLR0902 Too many instance attributes (10/7)
- pandas/core/resample.py:124:7: PLR0902 Too many instance attributes (13/7)
... 39 additional changes omitted for project

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

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLR0902 768 0 768 0 0

@MichaReiser MichaReiser changed the title Use delete_stmt PLR0203: Delete entire statement, including semicolons Feb 22, 2024
@MichaReiser
Copy link
Member

Thank you. I changed the implementation to store the Stmts in the HashMap instead of going over an index and I added a test for a simple statement list.

@MichaReiser MichaReiser enabled auto-merge (squash) February 22, 2024 15:47
@MichaReiser MichaReiser merged commit 7d9ce50 into astral-sh:main Feb 22, 2024
17 checks passed
@sanxiyn sanxiyn deleted the use-delete-stmt branch February 22, 2024 18:06
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants