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

Q003 autofix for triple nested quotes is not valid python code #8739

Closed
dragon-dxw opened this issue Nov 17, 2023 · 2 comments
Closed

Q003 autofix for triple nested quotes is not valid python code #8739

dragon-dxw opened this issue Nov 17, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@dragon-dxw
Copy link

Version: 0.1.5
input:
msg = f"Document \"{context['document'].name}\" does not have a PDF."
error [no args, invoked by precommit]:
judgments/views/document_full_text.py:38:19: Q003 [*] Change outer quotes to avoid escaping inner quotes
autofix via --fix [via precommit]
msg = f'Document "{context['document'].name}" does not have a PDF.'
which is not valid python

ruff config: https://github.com/nationalarchives/ds-caselaw-editor-ui/blob/chore/test-factory-improvements/pyproject.toml

@dragon-dxw dragon-dxw changed the title Q003 autofix not valid python Q003 autofix is not valid python code Nov 17, 2023
@dragon-dxw dragon-dxw changed the title Q003 autofix is not valid python code Q003 autofix for triple nested quotes is not valid python code Nov 17, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Nov 17, 2023
@sciyoshi
Copy link
Contributor

@dragon-dxw the fixed version is in fact valid syntax in Python 3.12. If you set the target Python version to 3.11 or lower in your configuration using target-version, this should no longer be marked as an error. See #7588

@charliermarsh
Copy link
Member

Yeah, in my testing this seems to be correctly detected based on the Python version. Do you mind testing if your Python version is set to Python 3.12? Happy to revisit if we're able to reproduce with a lower target-version.

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2023
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

No branches or pull requests

3 participants