Skip to content
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 redundant-u-string-prefix checker #4804

Merged
merged 4 commits into from Aug 6, 2021

Conversation

DanielNoord
Copy link
Collaborator

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature, or an important bug fix, add a What's New entry in
    doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Type of Changes

Type
✨ New feature

Description

This adds a checker for u-prefixes for strings, as used in Python 2.

Closes #4102

This adds a checker for u-prefixes for strings, as used in Python 2.
Closes pylint-dev#4102
@@ -89,10 +89,14 @@ Release date: TBA

Closes #626

* Add ``disable-next`` option: allows using `# pylint: disable-next=msgid` to disable a message for the following line
* Added ``disable-next`` option: allows using `# pylint: disable-next=msgid` to disable a message for the following line
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other changes also use past tense

@Pierre-Sassoulas Pierre-Sassoulas added Checkers Related to a checker Enhancement ✨ Improvement to a component labels Aug 5, 2021
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.10.0 milestone Aug 5, 2021
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Neat clean feature, thank you !

@DanielNoord
Copy link
Collaborator Author

Could a maintainer force re-run the checks? Something went wrong with the runners I think..

@Pierre-Sassoulas
Copy link
Member

I relaunched, CodeQL failed again but it's not a mandatory check. The pypy one seems genuine.

@DanielNoord
Copy link
Collaborator Author

Oops, looks like I forgot to run the test suite locally. I think I didn't expect pylint to use u-prefixes.. 😅

@DanielNoord
Copy link
Collaborator Author

Turns out astroid.Const.kind is only supported Python >=3.8.
@Pierre-Sassoulas do you know if there is a quick and easy way to infer the string kind on <=3.7?

@Pierre-Sassoulas
Copy link
Member

I don't know if it would be "easy" or "elegant", but it would be a change in astroid. Maybe we can do this check only in python 3.8+ ?

@DanielNoord
Copy link
Collaborator Author

Sure!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.004%) to 92.59% when pulling 1ecc2a7 on DanielNoord:u-prefix into 7d84a32 on PyCQA:main.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great new checker !

@Pierre-Sassoulas Pierre-Sassoulas merged commit 865765c into pylint-dev:main Aug 6, 2021
@DanielNoord DanielNoord deleted the u-prefix branch August 6, 2021 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Checkers Related to a checker Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add check for redundant u prefixed string in Python 3
3 participants