-
Notifications
You must be signed in to change notification settings - Fork 5.8k
change pylint error codes to messages #2700
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
change pylint error codes to messages #2700
Conversation
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.
Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)
af0cf58
to
0fb012d
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.
Thanks for the PR! The changes mostly look good :)
At a few places, the pylint comments went to another line (probably because the line became too long), so that the comment is now no longer at the line where pylint emits the warning. This is the reason that the tests fail. If you run pre-commit run -a
in your command line, then it will show you all the places were the comments need to be moved :) The contribution guide also has some details about pre-commit.
0fb012d
to
b77a2ba
Compare
thanks for feedback.i ran note that the
|
Thanks for the updates! I'm not sure why mypy complains about
🤔 So if you could fix that last one and the automated tests pass, then I'm happe 😄 |
FTR: I ran this and got a substantially different report from mypy than CI (posted above) python3 --version # Python 3.9.7
rm -rf venv
python3 -m venv venv
. ./venv/bin/activate
python3 -m pip install -r requirements-dev.txt -r requirements.txt
pre-commit run -a |
b69f53e
to
064c2fd
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.
Thanks for the updates :) Strange about mypy …
I left one nitpick below. In addition, up to now I had forgotten about the second part of #2664, namely doing the same for flake8, which are the # noqa
comments. I should have written that in the description of the issue as well … If you would like to tackle those as well, I'd be glad. Otherwise that can be done in another PR.
PS: Please don't force push on PRs if possible - makes it harder to keep track of changes during the review process and we squash-merge anyway :)
* use a map of pylint codes -> messages to replace all occurences, see below script * format with black * fix broken ignore rules after black added line breaks Closes: python-telegram-bot#2664 #!/bin/sh -e check() { grep -E -r -e '#.*pylint.*disable.*=[CW]+[0-9]+' | wc -l ;} check src_files="$(git ls-files '*.py')" pylint --list-msgs | grep '^:' | cut -d: -f2 | sed -e 's/(//g' -e 's/)//g' \ >/tmp/pylint-map-codes-to-msg while read -r msg code; do echo "checking code: $code" sed \ -e "s/${code}$/$msg/" \ -e "s/${code},/${msg}, /" \ -i $src_files # double-check ;) grep -e "$code" $src_files && echo 'OH NO!!' done </tmp/pylint-map-codes-to-msg check
064c2fd
to
437e03b
Compare
I couldn't find flake8 code's in-source string equivalents... ? |
flake8 comments can be found e.g. here
But, okay, let's make it a second PR.
Fair point. Would you like to PR for that yourself (based on v14)? |
thanks for merging, glad to help. you misunderstood; i know how to find |
mh, you are right. I don't know where exactly I got the idea from that this should be possible for flake8 as well, but it's indeed not. Thanks for the clarification :) |
Checklist for PRs
.. versionadded:: version
,.. versionchanged:: version
or.. deprecated:: version
to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)AUTHORS.rst
(optional)Closes #2664