-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
New checker - Detect use of unnecessary ellipsis #5470
New checker - Detect use of unnecessary ellipsis #5470
Conversation
Pull Request Test Coverage Report for Build 1574520196
π - Coveralls |
9e4db96
to
a285bc3
Compare
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.
LGTM !
Well except the fact it's in the string checker, it's not really related to strings, right ? |
Did not check where the code was added
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.
Just had a quick look and want to interrupt before @Pierre-Sassoulas might merge this:
Expected output of the tests is incorrect as it is missing the end line and column. This is because node
is not being passed to add_message
. This should be done!
@Pierre-Sassoulas This is something for future reviews as well: node
should be made mandatory (is on my todo list) but that requires some work. In the meantime we should require it for most new PRs.
You're right, my bad. Isn't that another breaking change for 3.0 ? |
Yeah! But adding a Just to let you know, I currently plan to first fix unittests and then fix statement(). After this it's back to typing |
1 similar comment
Yeah! But adding a Just to let you know, I currently plan to first fix unittests and then fix statement(). After this it's back to typing |
Sounds good ! |
pylint/checkers/base.py
Outdated
@@ -2270,6 +2270,32 @@ def _check_docstring( | |||
) | |||
|
|||
|
|||
class EllipsisChecker(_BasicChecker): |
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.
Please create a new file pylint/checker/ellipsis_checker.py
, as we want to burst base.py in #5489
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.
Thanks for separating the checker π
Note that I haven't done a full review but I think the 18 prefix is already being used. I'm on mobile so I can't link the file, but there is a script in the scripts folder that can point you to a new unused prefix. |
We could add a pre-commit script to check that, what do you think @DanielNoord ? Maybe based on the existing script for unused prefix. |
There is an open issue about this to which I assigned myself. Haven't gotten around to it because the unittests move take so much time and I think they are more important. |
β¦cessary_ellipsis
β¦essage_id_category.py`
Thanks for the advice @Pierre-Sassoulas & @DanielNoord π |
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.
Code itself looks good, I would only add some additional comments and explanations.
I'm also wondering if we should add a confidence level to this message.
- Informative Changelog, docstring & checker description
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.
Thanks for these changes, much better!
I just thought of one additional test case I think we should add by default: overloads.
Could you add an example? The mypy documentation should help with coming up with a simple but effective example.
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.
π
Closes #5460
Emit a warning when
...
is used and could be omitted. Similar to theunnecessary-pass
checker.Type of Changes
Description
Closes #5460