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

unidiomatic-typecheck has descriptive rather than prescriptive lint message text #3891

Closed
gpshead opened this issue Oct 9, 2020 · 1 comment · Fixed by #4305
Closed

unidiomatic-typecheck has descriptive rather than prescriptive lint message text #3891

gpshead opened this issue Oct 9, 2020 · 1 comment · Fixed by #4305
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors

Comments

@gpshead
Copy link

gpshead commented Oct 9, 2020

https://github.com/PyCQA/pylint/blob/master/pylint/checkers/base.py#L2314 unidiomatic-typecheck

The error message is currently along the lines of:

Using type() instead of isinstance() for a typecheck. [unidiomatic-typecheck]

which is easy for users to misread as "use type instead of isinstance" which is the opposite of what we want and is what their code already does, leaving them wondering what they're not seeing. The sentence isn't obviously stating that what it describes is a problem and doesn't directly suggest the solution.

I suggest rewording this lint message short description to be prescriptive

Use isinstance() rather than type() comparisons for a typecheck.

(this wording exists up through at least pylint 2.6.0)

@hippo91
Copy link
Contributor

hippo91 commented Oct 17, 2020

@gpshead thanks! I totally agree with you.
Would you mind making a PR for this?

@PCManticore PCManticore added Good first issue Friendly and approachable by new contributors Enhancement ✨ Improvement to a component labels Dec 28, 2020
@Pierre-Sassoulas Pierre-Sassoulas added the Help wanted 🙏 Outside help would be appreciated, good for new contributors label Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants