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

Fail gracefully when a loaded plugin in the pylintrc does not exists #4555

Closed
Pierre-Sassoulas opened this issue Jun 8, 2021 · 0 comments · Fixed by #4583
Closed

Fail gracefully when a loaded plugin in the pylintrc does not exists #4555

Pierre-Sassoulas opened this issue Jun 8, 2021 · 0 comments · Fixed by #4583
Labels
Enhancement ✨ Improvement to a component

Comments

@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Jun 8, 2021

Is your feature request related to a problem? Please describe

When a plugin does not exists there is a crash. For example using pylint 2.7.2 with a 2.8.3 pylintrc containing 'pylint.extensions.confusing_elif':

Traceback (most recent call last):
  File "/home/psassoulas/.local/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/home/psassoulas/.local/lib/python3.8/site-packages/pylint/__init__.py", line 24, in run_pylint
    PylintRun(sys.argv[1:])
  File "/home/psassoulas/.local/lib/python3.8/site-packages/pylint/lint/run.py", line 317, in __init__
    linter.load_plugin_modules(plugins)
  File "/home/psassoulas/.local/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 503, in load_plugin_modules
    module = astroid.modutils.load_module_from_name(modname)
  File "/home/psassoulas/.local/lib/python3.8/site-packages/astroid/modutils.py", line 210, in load_module_from_name
    return importlib.import_module(dotted_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pylint.extensions.confusing_elif'

Describe the solution you'd like

It would be better to fail gracefully and run all the other checks.

@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label Jun 8, 2021
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Jun 16, 2021
Raise an error 'bad-plugin-value' instead.
See pylint-dev#4555
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Jun 17, 2021
Raise an error 'bad-plugin-value' instead.
See pylint-dev#4555
Pierre-Sassoulas added a commit that referenced this issue Jun 17, 2021
Raise an error 'bad-plugin-value' instead.
See #4555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant