Skip to content

[pylint] Ignore mutable type updates in redefined-loop-name (PLW2901) - #25733

Merged
ntBre merged 2 commits into
astral-sh:mainfrom
KaufmanDmitriy:PLW2901
Jul 9, 2026
Merged

[pylint] Ignore mutable type updates in redefined-loop-name (PLW2901)#25733
ntBre merged 2 commits into
astral-sh:mainfrom
KaufmanDmitriy:PLW2901

Conversation

@KaufmanDmitriy

Copy link
Copy Markdown
Contributor

Summary

Addresses #24986

The rule has been updated to ignore cases where a mutable object is updated in-place. This makes the behavior consistent with how method‑based updates are already ignored.

Test Plan

Added new test cases

@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre June 7, 2026 18:17
@astral-sh-bot

astral-sh-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. I had a couple of suggestions for simplification and a request for the tests.

Comment thread crates/ruff_linter/src/rules/pylint/rules/redefined_loop_name.rs Outdated
Comment thread crates/ruff_linter/src/rules/pylint/rules/redefined_loop_name.rs Outdated
Comment thread crates/ruff_linter/resources/test/fixtures/pylint/redefined_loop_name.py Outdated
Comment thread crates/ruff_linter/src/rules/pylint/rules/redefined_loop_name.rs Outdated
@ntBre ntBre changed the title [pylint] Ignore mutable type updates in redefined-loop-name (PLW2901) [pylint] Ignore mutable type updates in redefined-loop-name (PLW2901) Jun 8, 2026
@ntBre ntBre added the rule Implementing or modifying a lint rule label Jun 8, 2026
@KaufmanDmitriy

Copy link
Copy Markdown
Contributor Author

@ntBre Hi, I made changes based on your suggestions, please review.

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! Sorry for the delay here, this looks great.

@ntBre
ntBre merged commit fb15b89 into astral-sh:main Jul 9, 2026
45 checks passed
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.

PLW2901 inconsistent with ior/iadd operations vx their method counterparts when in-place modiying

2 participants