You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question] why can't we add pylint in this repo hooks.yaml file? #157
and when I run pre-commit install it creates a repo for pylint in ~/.pre-commit/repoXXXX/ with its own virtual env in it, due to which pylint shows import errors.
So there are two ways to solve this error:
add all required packages in additional_dependencies in .pre-commit-config.yaml file for pylint.
But I can't add all the packages here because it useless to create two virtual env with same packages.
Can we however, merge it with our own virtualenv??
if I modify pre-commit-hooks/hooks.yaml and add pylint hook over there, it works perfectly fine.
Can you suggest me which is the best way to do it??
So tl;dr is pylint does some static analysis and some dynamic analysis. When put in an isolated virtualenv it does not work properly. Using isolated virtualenvs achieves the design goal of reproducibility in pre-commit.
That said, there are still a few options for using pylint with pre-commit:
disable the dynamic checking parts (not usually the desirable option)
use it as a "system" hook (usually through "local" hooks).
Activity
fixes issue pre-commit#157: adding pylint hook support
asottile commentedon Dec 7, 2016
So tl;dr is pylint does some static analysis and some dynamic analysis. When put in an isolated virtualenv it does not work properly. Using isolated virtualenvs achieves the design goal of reproducibility in pre-commit.
That said, there are still a few options for using pylint with pre-commit:
You can find some related issues:
fix: make pylint pre-commit a locak hook
Explain how to add pylint as a system hook
Explain pylint runs in an isolated virtualenv
Use system language for flake8 pre-commit hook
Use system language for flake8 pre-commit hook
swateek commentedon Jun 22, 2021
https://github.com/Yelp/venv-update/blob/de9e1befdecf448cf02ceb5c57a30bcc88a58c06/.pre-commit-config.yaml#L30-L36
is a good example, thank you!
Also, needed to install pylint
pip3 install pylint