Skip to content

[Infinite loop] PLC0414 conflicts with I002 if a useless alias is required #14283

@dscorbett

Description

@dscorbett

useless-import-alias (PLC0414) conflicts with missing-required-import (I002) in Ruff 0.7.3 if the latter rule is configured to require an alias that the former rule considers useless.

$ echo 1 | ruff check --isolated --select I002,PLC0414 --config 'lint.isort.required-imports = ["import numpy as numpy"]' - --unsafe-fixes --fix

error: Failed to converge after 100 iterations.

This indicates a bug in Ruff. If you could open an issue at:

    https://github.com/astral-sh/ruff/issues/new?title=%5BInfinite%20loop%5D

...quoting the contents of `-`, the rule codes I002, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
import numpy
1
-:1:1: I002 Missing required import: `import numpy as numpy`
Found 101 errors (100 fixed, 1 remaining).
[*] 1 fixable with the --fix option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions