Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infinite Loop] Failed to converge after 100 iterations. #3522

Closed
qarmin opened this issue Mar 14, 2023 · 2 comments · Fixed by #3609
Closed

[Infinite Loop] Failed to converge after 100 iterations. #3522

qarmin opened this issue Mar 14, 2023 · 2 comments · Fixed by #3609
Assignees
Labels
bug Something isn't working

Comments

@qarmin
Copy link

qarmin commented Mar 14, 2023

Ruff 0.0.255
Command

ruff ~/Desktop/Ruff/Broken/AcquireFile6.py --config /home/rafal/Desktop/ruff.toml --fix --no-cache

Settings

select = ["ALL"]

AcquireFile6.py.zip

produce error

error: Failed to converge after 100 iterations.

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

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

...quoting the contents of `AcquireFile6.py`, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

@charliermarsh charliermarsh added the bug Something isn't working label Mar 14, 2023
@vlindhol
Copy link
Contributor

vlindhol commented Mar 19, 2023

I took a look at this, and managed to narrow it down to the following minimal test case:

class A:
    """
\ a
    """

With the config:

select = [
  "D207", # bad docstring indentation
  "W605", # invalid escape sequence
]

Those two rules clash in the following way

  1. W605 schedules an insertion of a \ at column 0
  2. D207 schedules an insertion of .... (four spaces) at column 0
  3. End result: \ a -> \ + + \ a -> \ \ a
  4. GOTO 1

The culprit is the fairly simplistic way that "fix overlaps" are calculated. An easy workaround is for W605 to insert the \ in column 1 instead. I'll make a PR about it!

@charliermarsh
Copy link
Member

Thank you ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants