Skip to content

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

Conversation

Pierre-Sassoulas
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas commented May 3, 2020

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

Type
🐛 Bug fix
🔨 Refactoring

Related Issue

Closes #3576

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 90.238% when pulling 99034d0 on Pierre-Sassoulas:fix-malformed-pylintrc-crash into 3fffdf0 on PyCQA:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 90.238% when pulling 99034d0 on Pierre-Sassoulas:fix-malformed-pylintrc-crash into 3fffdf0 on PyCQA:master.

@coveralls
Copy link

coveralls commented May 3, 2020

Coverage Status

Coverage increased (+0.006%) to 90.242% when pulling 2571bab on Pierre-Sassoulas:fix-malformed-pylintrc-crash into 4756b3c on PyCQA:master.

Copy link
Contributor

@PCManticore PCManticore left a 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
Copy link
Contributor

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?

Copy link
Member Author

@Pierre-Sassoulas Pierre-Sassoulas May 5, 2020

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 :(

Copy link
Member Author

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

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the fix-malformed-pylintrc-crash branch from 99034d0 to 2571bab Compare May 10, 2020 07:00
@Pierre-Sassoulas Pierre-Sassoulas merged commit f00144f into pylint-dev:master May 10, 2020
@Pierre-Sassoulas Pierre-Sassoulas deleted the fix-malformed-pylintrc-crash branch May 10, 2020 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Malformed .pylintrc crashes any execution
3 participants