-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Exempt concatenated string literals for black --preview
compatibility
#32
Comments
Hi and thanks for bringing this up. I agree that these parenthesis are helpful and am inclined to add an exception for them. The exact rules when to exempt them from the lint and when not to need some thinking on my side (and playing around with black to see the black authors' option on this) . I'm curious: why would you use a linter like flake8 in conjunction with black? Isn't black supposed to reformat the code, (almost) no questions asked? So why would one want to run a linter after that? |
Linters go much farther than surface-level formatting! See for example the list of rules supported by Ruff (a faster Rust-based successor to Flake8 plus dozens of plugins). They cover a huge spectrum of issues from performance to readability to security, and sometimes help teach you things about obscure corners of Python that you didn’t know you didn’t know. As for your particular plugin, I used it to find a subtle bug in Zulip that had slipped past Black, Ruff, mypy, and human review: So I’d love to help improve the logic to eliminate false positives, and then get it ported to Ruff so we can use it in our CI. |
Has been released in version 0.5.1. Thanks again for the input. |
black --preview
enforces parentheses for concatenated string literals within comma-separated expressions:These extra parentheses make it much easier to catch bugs where you’re missing commas in a list of strings, but flake8-picky-parentheses flags them as redundant with
PAR001
. Consider exempting parens around a concatenated string literal followed by a comma.The text was updated successfully, but these errors were encountered: