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
Flag superfluous-parens
if parentheses are used during string concatenation.
#7752
Flag superfluous-parens
if parentheses are used during string concatenation.
#7752
Conversation
hi = ("CONST",) | ||
|
||
#TODO: maybe get this line to report [superfluous-parens] without causing other false positives. | ||
assert "" + ("Version " + "String") in Z |
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.
alright so this is a legitimate case for raising superlous-parens and was brought up in the issue, but I cannot fix it without causing other bigger issues. I think it's probably ok to leave this as a false negative?
dcae0f5
to
b8334ed
Compare
Do you know what's up with the |
Do you know what's up with the alternative-union-syntax test failure? Fixed. Disabling superfulous-parens in alternative_union_syntax:52 is reasonable given that we aren't testing for that, but also the msg being raised is also correct there bc CustomTypedDict = TypedDict("CustomTypedDict", my_var=(int | str)) == CustomTypedDict = TypedDict("CustomTypedDict", my_var=int | str) |
Pull Request Test Coverage Report for Build 3455686088
π - Coveralls |
4198826
to
1f98ceb
Compare
This comment has been minimized.
This comment has been minimized.
I looked at some of the primer outputs and it actually seems like this is working exactly as we want! |
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.
I think it's not a big scope change to add :=
, so marking request changes for now. I think you'll need to create a new test file with min_pyver=3.8
in the corresponding .rc
file, which you can find examples of.
1f98ceb
to
2226312
Compare
This comment has been minimized.
This comment has been minimized.
Sorry, one more thing. You could change the news fragment to end with |
Type of Changes
Description
Closes #4792
This PR ensures that
superfluous-parens
is emitted if str concatenation is happening but the parentheses are not necessary, that is without the parens the concat result is the same as with them.