Skip to content

[Infinite loop] Conflict between F401 and PLC0414; redundant alias is removed, redundant alias is added as re-export #18365

@GideonBear

Description

@GideonBear

Ref #14283

pyproject.toml:

[tool.ruff]
lint.select = [ "F401", "PLC0414" ]
lint.preview = true

package/__init__.py:

from package.module import function

package/module.py:

def function(): ...

Run this command: ruff check --unsafe-fixes --fix
Result:

$ ruff check --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 `package/__init__.py`, the rule codes F401, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

package/__init__.py:1:28: F401 `package.module.function` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
  |
1 | from package.module import function
  |                            ^^^^^^^^ F401
  |
  = help: Use an explicit re-export: `function as function`

Found 101 errors (100 fixed, 1 remaining).
[*] 1 fixable with the --fix option.

Metadata

Metadata

Assignees

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