-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix crash when the user ask for --version and pylintrc is malformed #3581
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
Fix crash when the user ask for --version and pylintrc is malformed #3581
Conversation
1 similar comment
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.
This looks good, thanks for handling it.
@@ -2,6 +2,11 @@ | |||
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING | |||
|
|||
import re | |||
import sys | |||
|
|||
from astroid.__pkginfo__ import version as astroid_version |
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.
Can we grab it directly from __pkginfo__
as that is the source of truth for the version?
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.
Putting this version in __pgfinfo__
creates a 10+ links circular import error. I originally put it there :(
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.
We can't because in __pkginfo__
we're defining the dependencies for the setup.py so astroid is not installed yet. We could do it if we put the dependencies in the setup.py/pyproject.toml directly
Can't find where the version is even printed in a normal case.
99034d0
to
2571bab
Compare
Description
This fix #3576 albeit in a hacky way (?) I refactored a little the version that was stored in every checker apparently. What could be the reason to do that? Also, I wonder why the BaseChecker inherit from OptionProviderMixin? Couldn't we parse the option once and give each checker it's own options so we can instantiate a checker without using sys args and optparse?
Type of Changes
Related Issue
Closes #3576