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

Rules D210, RSE102 causes autofix error #6810

Closed
qarmin opened this issue Aug 23, 2023 · 1 comment · Fixed by #6886
Closed

Rules D210, RSE102 causes autofix error #6810

qarmin opened this issue Aug 23, 2023 · 1 comment · Fixed by #6886
Assignees
Labels
accepted Ready for implementation bug Something isn't working fuzzer Surfaced via fuzzing.

Comments

@qarmin
Copy link

qarmin commented Aug 23, 2023

Ruff 0.0.285 (latest changes from main branch)

ruff  *.py --select ALL --no-cache

file content:

DOCUMENTATION = """
"""
"""Check that raise ... from .. uses a proper exception cause """
class ExceptionSubclass(Exception):
    raise IndexError()from ZeroDivisionError

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/astral-sh/ruff/issues/new?title=%5BAutofix%20error%5D

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

PY_FILE_TEST_1219302773.py.zip

@charliermarsh charliermarsh added bug Something isn't working fuzzer Surfaced via fuzzing. labels Aug 23, 2023
@charliermarsh
Copy link
Member

Nice, I assume the issue is that we're changing to raise IndexErrorfromZeroDivisionError. If we remove parens, and there's no whitespace between the () and the form, we need to insert a space.

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

Successfully merging a pull request may close this issue.

2 participants