Add B028 - suggest !r for quote-wrapped variables in f-strings#328
Add B028 - suggest !r for quote-wrapped variables in f-strings#328Zac-HD merged 1 commit intoPyCQA:mainfrom
Conversation
cooperlees
left a comment
There was a problem hiding this comment.
Sounds good to do >= 3.8 - Lets just state that in the README.rst description of this check please (that is missing here).
3.7 still has another ~6 months of life, we've kind of decided to follow python supported versions and follow flake8 version dropping. So I would expect 3.7 to hang around for little while longer ...
a320fdb to
73aa5ce
Compare
|
Added Readme and Change Log entry. Now won't warn if there's any format specifiers only valid for numerics - or width specified (which will misplace quotes relative to the padding). And you said you wanted lots of tests, so there's now >90k checks 😅 The format spec permutation test takes a few seconds to run on my machine, but not much slower than the existing fuzz tests. I can scale it back if you think it's overkill though |
… in an f-string is surrounded by quotes
73aa5ce to
ef39e9a
Compare
cooperlees
left a comment
There was a problem hiding this comment.
Thanks John! All looks good to me. Will see if @Zac-HD pops past at all to double check :)
Zac-HD
left a comment
There was a problem hiding this comment.
Looks fantastic - thanks John!
fixes #319
I decided not to implement 3.7 support at all, expecting it to be dropped soon enough / be rare enough that it's not worth the added code complexity to support it.
3.8 is somewhat of a pain with not having
ast.unparse, but this implementation should be decent-ish even when there's complex contents of an f-string variable.This should likely not be merged until edge cases in #319 has been sorted out.
@Zac-HD