Skip to content

[Infinite loop] I002 and PLR0402 #20380

@dscorbett

Description

@dscorbett

Summary

Ruff fails to converge when missing-required-import (I002) and manual-from-import (PLR0402) are selected and a redundant alias is required. Example:

$ echo 1 | ruff --isolated check - --select I002,PLR0402 --config 'lint.isort.required-imports=["import concurrent.futures as futures"]' --diff

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!

@@ -1 +1,51 @@
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
+from concurrent import futures
 1

Would fix 100 errors.

Version

ruff 0.13.0 (a1fdd66 2025-09-10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions