-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add unspecified-encoding checker #3826 #4753
Add unspecified-encoding checker #3826 #4753
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.
Thank you for handling this issue. This looks great. I made some small comments but this is definitely going in 2.10.0
:).
5dad835
to
ed6aca8
Compare
@Pierre-Sassoulas I merged all your suggestions + added checks for I do not really have any experience with other |
I think we should handle |
ed6aca8
to
f00bdd8
Compare
Added the check for However, the test suite is failing on some files which have not been edited by these commits while it is up to date with the main branch (besides the latest commit to issue forms). |
Well what happened is you discovered style problem inside pylint with your new checker 😄 The new problem in pylint should be fixed in this merge request, we can discuss them here. Maybe it'll fix strange bug that happened only on some particular OS 🎉 Or it can be problem in existing functional tests that are now detected. You can disable those new messages in the existing tests so there is no change in the expected output, or update the output if you think this make more sense. |
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.
👍
f00bdd8
to
7ca64c0
Compare
Added some additional Edit: Found some additional errors.. Back to the drawing board I guess, lol |
Always happy to help :) Also don't stress out, this won't be merged before 2.10, so not before 2.9.6 is out 🙂 Regarding the latest change to fix the tests, it looks most of the changes are in functional tests. Please don't modify the functional test too much, you can disable the new checker with |
Ah shit, I just changed some of the tests to include |
A mix of disabling, changing the code and checking that the warning is raised is fine, it should not be one sided though, more like a third of each. (To be faire disable or checking that it's raised is an easier change but you already did the work of changing the code so... 😄) I don't think the test suite run in the CI for mac right now as we have linux and windows only. So, its possible that we have some existing problem on mac. We supposed mac/linux were close enough and not worth the added pipeline time. Apparently it's not. You can check on the master branch for the test that are already failing while we fix this. |
Hmm, after fixing my formatter the tests are now also raising a number of issues with the code of pylint itself. I would be very glad to fully fix all errors, but this won't be done tonight. Seeing as pylint has such a good test coverage already, I would feel bad if my contribution would lead to an increase in skipped checks. I will try and group some of the changes in similar commits for easier review. We can always squash those before the final merge. |
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.
What a first PR 🔥 I like it a lot! Did a test run and it already worked beautifully.
As this will go in 2.10
, there is still some time. So you don't need to hurry.
7296334
to
4ff8037
Compare
This adds an unspecified-encoding checker that adds a warning whenever open() is called without an explicit encoding argument. This closes pylint-dev#3826
With addition of the unspecified-encoding checker calls of open() need an encoding argument. Where necessary this argument has been added, or the message has been disabled. This also includes small linting changes to a small number of tests. Their test-data has been updated to reflect new line numbers.
With addition of the unspecified-encoding checker calls of open() need an encoding argument. Where necessary this argument has been added.
With addition of the unspecified-encoding checker calls of open() need an encoding argument. Where necessary this argument has been added.
4ff8037
to
05b8ba5
Compare
Almost made it work. Again, sorry for taking so much of your time... Action at personal repo shows that the PR succeeds for CPython 3.8 =<, but fails for 3.7, 3.6 and pypy. I thought appending |
You would need to create a file like this one: generic_alias_typing.rc. With the same name as the test file, only One more thing, I would appreciate if you wouldn't force push all your new changes. That makes it really difficult to review them. We can squash merge the PR in the end so it doesn't make a difference if there are 10+ commits. Usually a force push should only be used when doing a rebase to catch up with the latest changes on |
I'm really sorry! I thought you might want a commit history that represents a possible final history. |
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.
Looks good 🚀
Left some last comments
Co-authored-by: Marc Mueller <[email protected]>
Haaa. I made a mistake I should have waited for 2.9.6 to be released before merging. |
In that case, what do you think about releasing |
Also note that I didn't have time to merge @cdce8p's last comment |
doc/whatsnew/<current release.rst>
.Type of Changes
Description
This adds an unspecified-encoding checker that adds a warning whenever open() is called without an explicit encoding argument.
This closes #3826.
I stumbled upon this issue today while I experienced the importance of adding
encoding
toopen()
. This is my first contribution to pylint so please let me know if anything needs to be changed or improved!