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

Detect enumerate iterations in loop-iterator-mutation #12366

Merged
merged 1 commit into from
Jul 17, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

Closes #12164.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jul 17, 2024
Copy link
Contributor

github-actions bot commented Jul 17, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+5 -0 violations, +0 -0 fixes in 4 projects; 50 projects unchanged)

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

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

+ airflow/utils/cli.py:150:17: B909 Mutation to loop iterable `full_command` during iteration

python/mypy (+1 -0 violations, +0 -0 fixes)

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

+ mypy/typeops.py:949:21: B909 Mutation to loop iterable `proper_types` during iteration

zulip/zulip (+2 -0 violations, +0 -0 fixes)

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

+ zerver/lib/markdown/nested_code_blocks.py:82:17: B909 Mutation to loop iterable `parent` during iteration
+ zerver/lib/markdown/nested_code_blocks.py:83:17: B909 Mutation to loop iterable `parent` during iteration

pytest-dev/pytest (+1 -0 violations, +0 -0 fixes)

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

+ scripts/release.py:54:17: B909 Mutation to loop iterable `lines` during iteration

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
B909 5 5 0 0 0

@charliermarsh
Copy link
Member Author

I need to allow assignments to the current key.

@charliermarsh charliermarsh merged commit 1de8ff3 into main Jul 17, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/B9 branch July 17, 2024 16:03
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.

Rule B909 (loop-iterator-mutation) doesn't detect many kinds of list mutation
1 participant