-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[flake8-quotes
] Fix Autofix Error (Q000, Q002
)
#10199
[flake8-quotes
] Fix Autofix Error (Q000, Q002
)
#10199
Conversation
Not needed. Deactivation leads to more granular tests.
6c24c63
to
b5c02e5
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR6201 | 25 | 0 | 25 | 0 | 0 |
PLR0917 | 5 | 0 | 5 | 0 | 0 |
PLR6301 | 3 | 0 | 3 | 0 | 0 |
PLR0916 | 2 | 0 | 2 | 0 | 0 |
E999 | 1 | 1 | 0 | 0 | 0 |
PLR0914 | 1 | 0 | 1 | 0 | 0 |
PLW1641 | 1 | 0 | 1 | 0 | 0 |
CodSpeed Performance ReportMerging #10199 will not alter performanceComparing Summary
|
This reverts commit e65d99f.
@charliermarsh, do you mind to review this fix? Thanks! |
flake8-quotes
] Fix Autofix Error (Q000, Q002
)flake8-quotes
] Fix Autofix Error (Q000, Q002
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, thanks! Appreciate all the additional tests. Sorry it took me so long to get to it.
f6f56c8
to
f4da30c
Compare
Summary
In issue #6785 it is reported that a docstring in the form of
''"assert" ' SAM macro definitions '''
is autocorrected to"""assert" ' SAM macro definitions '''
(note the triple quotes one only one side), which breaks the python program dueundetermined string lateral
.Q002
: Not only would docstrings in the form of''"assert" ' SAM macro definitions '''
(single quotes) be autofixed wrongly, but also e.g.""'assert' ' SAM macro definitions '''
(double quotes). The bug is present for docstrings in all scopes (e.g. module docstrings, class docstrings, function docstrings)Q000
: The autofix error is not only present forQ002
(docstrings), but also for inline strings (Q000
). Therefores = ''"assert" ' SAM macro definitions '''
will also be wrongly autofixed.Note that situation in which the first string is non-empty can be fixed, e.g.
'123'"assert" ' SAM macro definitions '''
->"123""assert" ' SAM macro definitions '''
is valid.What
Q000
Q002
toSometimes
Test Plan
Q000
: Add docstrings in different scopes that (partially) would have been autofixed wronglyQ002
: Add inline strings that (partially) would have been autofixed wronglyCloses #6785