RUF067: Allow dunder-named assignments in non-strict mode#24089
Merged
MichaReiser merged 2 commits intoastral-sh:mainfrom Mar 30, 2026
Merged
RUF067: Allow dunder-named assignments in non-strict mode#24089MichaReiser merged 2 commits intoastral-sh:mainfrom
RUF067: Allow dunder-named assignments in non-strict mode#24089MichaReiser merged 2 commits intoastral-sh:mainfrom
Conversation
21e691d to
eb67799
Compare
Contributor
Author
|
Hi @MichaReiser Can you review my pr and share your feedback? |
Member
|
I know you don'd mean any harm. But please give us some more time. We give our best to review PRs and respond to issues in a timely manner and more notifications doesn't help. |
eb67799 to
379f50b
Compare
MichaReiser
approved these changes
Mar 30, 2026
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF067 | 10 | 0 | 10 | 0 | 0 |
RUF067: Allow dunder-named assignments in non-strict mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#22822: tools like mkinit use dunder names (
__submodules__, etc.) in__init__.py. RUF067 only allowed a fixed list, so those were flagged.When
strictly-empty-init-modulesis off, the rule now ignores assignments (including+=and annotated assigns) if every target is a simple name and each name is a dunder (is_dunderinruff_python_ast). Chained assigns still need every target to be a dunder. Strict mode is unchanged.Also means non-
extend_path__path__ = …is allowed in non-strict mode, per the issue discussion.Closes #22822
Test Plan
Updated
RUF067/modules/__init__.pyand the two RUF067 snapshots. Rancargo test -p ruff_linter --liband clippy onruff_linter.