Skip to content

Comments

Fix F841 false negative on assignment to multiple variables#8489

Merged
charliermarsh merged 6 commits intoastral-sh:mainfrom
tjkuson:F841-fix
Nov 5, 2023
Merged

Fix F841 false negative on assignment to multiple variables#8489
charliermarsh merged 6 commits intoastral-sh:mainfrom
tjkuson:F841-fix

Conversation

@tjkuson
Copy link
Contributor

@tjkuson tjkuson commented Nov 4, 2023

Summary

Closes #8441 behind preview feature flag.

Test Plan

cargo test

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2023

ruff-ecosystem results

Linter (stable)

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

rotki/rotki (+1 -0 violations, +0 -0 fixes)

+ rotkehlchen/tests/unit/decoders/test_makerdao_sai.py:2250:13: F841 Local variable `__annotations__` is assigned to but never used

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
F841 1 1 0 0 0

Linter (preview)

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

RasaHQ/rasa (+39 -0 violations, +0 -0 fixes)

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

+ rasa/telemetry.py:594:30: F841 Local variable `tb` is assigned to but never used
+ rasa/telemetry.py:594:9: F841 Local variable `exc_type` is assigned to but never used
+ tests/cli/test_rasa_export.py:278:5: F841 Local variable `events` is assigned to but never used
+ tests/core/evaluation/test_marker.py:287:13: F841 Local variable `expected` is assigned to but never used
+ tests/core/evaluation/test_marker.py:307:13: F841 Local variable `expected` is assigned to but never used
+ tests/core/evaluation/test_marker.py:558:13: F841 Local variable `expected_size` is assigned to but never used
+ tests/core/evaluation/test_marker.py:583:13: F841 Local variable `expected_size` is assigned to but never used
+ tests/core/test_evaluation.py:152:23: F841 Local variable `num_stories` is assigned to but never used
+ tests/core/test_evaluation.py:319:23: F841 Local variable `num_stories` is assigned to but never used
+ tests/core/training/test_interactive.py:818:11: F841 Local variable `kwargs` is assigned to but never used
... 29 additional changes omitted for project

alteryx/featuretools (+20 -0 violations, +0 -0 fixes)

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

+ featuretools/computational_backends/feature_set.py:113:9: F841 Local variable `node_needs_full_dataframe` is assigned to but never used
+ featuretools/primitives/utils.py:144:9: F841 Local variable `trans_valid_inputs` is assigned to but never used
+ featuretools/primitives/utils.py:145:9: F841 Local variable `trans_return_type` is assigned to but never used
+ featuretools/primitives/utils.py:151:9: F841 Local variable `agg_valid_inputs` is assigned to but never used
+ featuretools/primitives/utils.py:152:9: F841 Local variable `agg_return_type` is assigned to but never used
+ featuretools/tests/computational_backend/test_calculate_feature_matrix.py:1668:9: F841 Local variable `client` is assigned to but never used
+ featuretools/tests/computational_backend/test_calculate_feature_matrix.py:1707:9: F841 Local variable `client` is assigned to but never used
+ featuretools/tests/primitive_tests/test_agg_feats.py:609:9: F841 Local variable `features` is assigned to but never used
+ featuretools/tests/primitive_tests/test_agg_feats.py:683:9: F841 Local variable `features` is assigned to but never used
+ featuretools/tests/primitive_tests/test_agg_feats.py:809:9: F841 Local variable `features` is assigned to but never used
... 10 additional changes omitted for project

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

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

+ airflow/cli/commands/celery_command.py:192:16: F841 Local variable `stderr` is assigned to but never used
+ airflow/cli/commands/celery_command.py:192:24: F841 Local variable `log_file` is assigned to but never used
+ airflow/cli/commands/celery_command.py:192:8: F841 Local variable `stdout` is assigned to but never used
+ airflow/configuration.py:1596:22: F841 Local variable `source` is assigned to but never used
+ airflow/configuration.py:687:25: F841 Local variable `should_continue` is assigned to but never used
+ airflow/io/store/path.py:164:31: F841 Local variable `o_key` is assigned to but never used
+ airflow/providers/google/cloud/log/gcs_task_handler.py:178:33: F841 Local variable `stackinfo` is assigned to but never used
+ airflow/providers/google/cloud/transfers/s3_to_gcs.py:228:9: F841 Local variable `gcs_bucket` is assigned to but never used
+ airflow/providers/google/cloud/transfers/s3_to_gcs.py:242:9: F841 Local variable `gcs_bucket` is assigned to but never used
+ airflow/providers/google/cloud/transfers/s3_to_gcs.py:250:30: F841 Local variable `dest_gcs_object_prefix` is assigned to but never used
... 55 additional changes omitted for project

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

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

+ tests/integration/init/test_init_command.py:1012:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:118:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:150:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:182:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:214:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:248:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:282:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:316:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:529:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:558:17: F841 Local variable `stdout_data` is assigned to but never used
... 36 additional changes omitted for project

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

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

+ src/bokeh/sphinxext/bokeh_model.py:117:34: F841 Local variable `arglist` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_model.py:117:43: F841 Local variable `retann` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_model.py:117:9: F841 Local variable `name_prefix` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_options.py:104:36: F841 Local variable `arglist` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_options.py:104:45: F841 Local variable `retann` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_options.py:104:9: F841 Local variable `name_prefix` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_plot.py:254:15: F841 Local variable `lineno` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_settings.py:84:32: F841 Local variable `arglist` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_settings.py:84:41: F841 Local variable `retann` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_settings.py:84:9: F841 Local variable `name_prefix` is assigned to but never used
... 15 additional changes omitted for project

commaai/openpilot (+2 -0 violations, +0 -0 fixes)

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

+ tools/sim/bridge/metadrive/metadrive_process.py:90:30: F841 Local variable `info` is assigned to but never used
+ tools/sim/bridge/metadrive/metadrive_process.py:90:7: F841 Local variable `obs` is assigned to but never used

demisto/content (+523 -0 violations, +0 -0 fixes)

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

+ Documentation/common_server_docs.py:252:5: F841 Local variable `js_doc` is assigned to but never used
+ Documentation/common_server_docs.py:256:5: F841 Local variable `ps_doc` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:762:14: F841 Local variable `RET` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:762:29: F841 Local variable `rmsg` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:762:9: F841 Local variable `SDL` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:824:14: F841 Local variable `RET` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:824:24: F841 Local variable `rcs` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:824:29: F841 Local variable `rmsg` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:839:14: F841 Local variable `RET` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:839:24: F841 Local variable `rcs` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:839:29: F841 Local variable `rmsg` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:839:9: F841 Local variable `SDL` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:856:24: F841 Local variable `rcs` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:856:29: F841 Local variable `rmsg` is assigned to but never used
+ Packs/ARIAPacketIntelligence/Integrations/ARIAPacketIntelligence/ARIAPacketIntelligence.py:856:9: F841 Local variable `SDL` is assigned to but never used
+ Packs/AWS-GuardDuty/Integrations/AWSGuardDutyEventCollector/AWSGuardDutyEventCollector_test.py:241:13: F841 Local variable `new_last_ids` is assigned to but never used
+ Packs/AWS-GuardDuty/Integrations/AWSGuardDutyEventCollector/AWSGuardDutyEventCollector_test.py:241:27: F841 Local variable `new_collect_from` is assigned to but never used
+ Packs/AWS-GuardDuty/Integrations/AWSGuardDutyEventCollector/AWSGuardDutyEventCollector_test.py:303:13: F841 Local variable `new_last_ids` is assigned to but never used
... 505 additional changes omitted for project

docker/docker-py (+31 -0 violations, +0 -0 fixes)

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

+ docker/api/image.py:401:19: F841 Local variable `repo_name` is assigned to but never used
+ docker/api/image.py:476:19: F841 Local variable `repo_name` is assigned to but never used
+ docker/api/plugin.py:132:19: F841 Local variable `repo_name` is assigned to but never used
+ docker/api/plugin.py:173:19: F841 Local variable `repo_name` is assigned to but never used
+ docker/api/plugin.py:199:19: F841 Local variable `repo_name` is assigned to but never used
+ docker/api/plugin.py:252:19: F841 Local variable `repo_name` is assigned to but never used
+ docker/api/service.py:166:19: F841 Local variable `repo_name` is assigned to but never used
+ docker/api/service.py:447:23: F841 Local variable `repo_name` is assigned to but never used
+ docker/transport/npipesocket.py:121:9: F841 Local variable `err` is assigned to but never used
+ docker/transport/npipesocket.py:143:13: F841 Local variable `err` is assigned to but never used
... 21 additional changes omitted for project

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

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
F841 1417 1417 0 0 0

@tjkuson
Copy link
Contributor Author

tjkuson commented Nov 4, 2023

None of the new violations seem to be incorrect, but there are a lot of them. Moved the behaviour change behind the preview flag.

@tjkuson tjkuson marked this pull request as ready for review November 4, 2023 17:17
@tjkuson tjkuson marked this pull request as draft November 4, 2023 17:28
@tjkuson tjkuson marked this pull request as ready for review November 4, 2023 17:36
@tjkuson
Copy link
Contributor Author

tjkuson commented Nov 4, 2023

I don't know why there is a non-preview ecosystem change...

Edit: it's because the repo enables them.

@T-256
Copy link
Contributor

T-256 commented Nov 4, 2023

I don't know why there is a non-preview ecosystem change...

rotki uses preview = true in pyproject.toml, I think there is problem in ruff_ecosystem pacakge.

possible solution is adding --force-no-preview to cli.

@charliermarsh charliermarsh merged commit 8c0d65c into astral-sh:main Nov 5, 2023
@charliermarsh
Copy link
Member

Thanks! Also confirmed the above (that Rotki enables preview on their develop branch).

@tjkuson tjkuson deleted the F841-fix branch November 5, 2023 17:20
zanieb added a commit that referenced this pull request Nov 20, 2023
Addresses
#8489 (comment)
That issues still exist on formatter, but since `black` doesn't support
`no-preview` cli arg, I didn't include it in this PR.

---------

Co-authored-by: Zanie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F841 false negative on assignment to multiple variables

3 participants