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

[Autofix] Failed to autofix oneline python file #3585

Closed
qarmin opened this issue Mar 17, 2023 · 2 comments · Fixed by #3584
Closed

[Autofix] Failed to autofix oneline python file #3585

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

Comments

@qarmin
Copy link

qarmin commented Mar 17, 2023

Ruff 1dd3cbd
No config

ruff . --fix

on

"()"""" Wrapper namespace for re type aliases. """

cause error

error: Autofix introduced a syntax error. Reverting all changes.

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

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

...quoting the contents of `/home/rafal/Desktop/RunEveryCommand/Ruff/Broken/42002re (147th copy)0.py`, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

42002re (147th copy)0.py.zip

@charliermarsh
Copy link
Member

I think this should be fixed by #3584 too.

@qarmin
Copy link
Author

qarmin commented Mar 17, 2023

Yes, there is no crash anymore

@charliermarsh charliermarsh added the bug Something isn't working label Mar 17, 2023
@charliermarsh charliermarsh self-assigned this Mar 17, 2023
charliermarsh added a commit that referenced this issue Mar 19, 2023
## Summary

In the rare event that a docstring contains an implicit string concatenation, we currently have the potential to panic, because we assume that if a string starts with triple quotes, it _ends_ with triple quotes. But with implicit concatenation, that's not the case: a single `Expr` could start and end with different quote styles, because it can contain multiple string tokens.

Supporting these "properly" is pretty hard. In some cases it's hard to even know what the "right" behavior is. So for now, I'm just detecting and warning, which is better than a panic.

Closes #3543.

Closes #3585.
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.

2 participants