Skip to content

Submodule imports: "first from first serve" analysis is too coarse #1482

@Gankra

Description

@Gankra

This is a followup to astral-sh/ruff#21173 and pertains to behaviours described in imports/nonstandard_conventions.md

The "first from first serve" rule says it applies to the "first time in this scope (or any parent scope)", but we actually only implement "first time in the entire file" which doesn't make sense but was easy to implement and worked well. There is a test in that file that currently demonstrates the failure mode of this (two functions import a submodule, only the first function gets the submodule as a local).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingimportsModule resolution, site-packages discovery, import-related diagnostics

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions