-
Notifications
You must be signed in to change notification settings - Fork 23
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
single-element tuple #135
single-element tuple #135
Conversation
Found from PyCQA/flake8-pyi#135.
False positives included:
|
Okay, you've persuaded me that this is a serious problem that needs some kind of automated check. Let's do it, but figure out how we can limit the false positives. Seems like |
I had kind of the opposite reaction :) It's a lot of false positives. I feel like my ideal state would be a non-blocking GitHub Action that adds a comment like "did you really want a single-element tuple here?". |
Clippy but for code. Sure. |
Another alternative would be to add some heuristics when the warning won't trigger. Starting with the 52 false positives that remain, we can get to:
(These numbers could be off by one, because they were generated by an ugly script.) In practice, implementing all of these checks is overkill, and just skipping |
I think I found the combination that reduces the most false positives compared to how much work it would be to implement:
Just these two bring us from 52 false positives to 21 false positives. |
I don't like that because it's going to be very unintuitive for users. I could get behind excluding the pickle-related methods though. |
Also @Akuli would you mind double checking the two hits in tkinter? It wasn't really clear from the code what was going on there.
|
Line 997: The annotations have a lot of room for improvement. But
The annotation of |
I am +1 on non-blocking GitHub Action suggestion. The same for We don't want to turn our code base into |
Implementation specific, we can add a new code for it, like But, later we can enable it in our CI like So, our users will be warned with minimal damage done! 👍 And, please, don't forget about non-typeshed users like me 🙂 |
We actually had some trouble getting disabled-by-default errors to work Do you know what we might have been doing wrong/how to get it working? |
I have some plugins that use explicit https://flake8.pycqa.org/en/latest/user/options.html?highlight=enable-extensions#cmdoption-flake8-enable-extensions with no problems. Example: https://github.com/globality-corp/flake8-logging-format#violations-detected |
No tests yet, just want to show what this does on typeshed
Fixes #131