Skip to content

Add I301 check, for TYPE_CHECKING too far from previous import#217

Open
dgw wants to merge 1 commit intoPyCQA:mainfrom
dgw:error/new/I301
Open

Add I301 check, for TYPE_CHECKING too far from previous import#217
dgw wants to merge 1 commit intoPyCQA:mainfrom
dgw:error/new/I301

Conversation

@dgw
Copy link

@dgw dgw commented Jun 20, 2025

Follow-up to suggested new check in #214 (comment). Thanks to the testing framework already in place, I'm reasonably confident that this has no unintended side-effects. 😁

The new code I301 covers both "too many newlines" and "non-import stuff between the other imports and TYPE_CHECKING" cases. (This way was cleaner than trying to keep track of the previous_non_import node, which would complicate the iterator.)

@sigmavirus24 sigmavirus24 added this to the 0.20.0 milestone Jun 22, 2025
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.

2 participants