-
Notifications
You must be signed in to change notification settings - Fork 107
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
Detect inline implicit string concatenation #435
Conversation
My only worry here is libcst is a big depedency to add ... We been light on (and could prob remove attrs with dataclasses these days - but I forget what we use) dependencies on purpose and wanted to be a pure python project for runtime simplicity. libcst is compiled but the right library for this job none the less. I'd like to see how other contributors + maintainers feel about bringing this dependency in. It brings in many benefits, but now could slow our move to new Python runtimes and brings in the potential for people having wheel install issues + build the extension etc. etc. |
I agree with your intuition that it's better to keep flake8-bugbear pure Python. It's good to minimize dependencies. We could reconsider if there are more lints that we want to add but that are only achievable with libcst. |
Is there a feasible pure python way to implement these checks? If not, I think we should close this PR. I thank you for the efforts tho. Jelle and I (plus other maintainers) bear the pain of black and other projects having compiled dependencies. They lead to a lot of Issues opened. As it's really just me and Jelle here, I'd like to avoid that overhead. I wonder if someone has started a dedicated libcst based flake8-plugin so people can choose a compiled plugin if they want. If so, maybe the check can go there. |
As specified here #156 - this adds a check for inline implicit string concatenation as a new error B036
E.g.
becomes
This grabs the segment of the original source and parses it with libcst to see if it's a
ConcatenatedString
. Had to modify some unittests that manually fed in the AST to also feed in the source lines.