-
-
Notifications
You must be signed in to change notification settings - Fork 705
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
[Question] why can't we add pylint in this repo hooks.yaml file? #157
Labels
Comments
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:
|
This was referenced Dec 11, 2018
0xangelo
referenced
this issue
in 0xangelo/deep-rl
Jun 16, 2019
Was having errors similar to this issue: `https://github.com/pre-commit/pre-commit-hooks/issues/157` Using it locally fixes `import-error`. Signed-off-by: Ângelo Lovatto <angelolovatto@gmail.com>
aleb
added a commit
to aleb/mirrors-pylint
that referenced
this issue
Dec 21, 2019
As described in pre-commit/pre-commit-hooks#157 using this hook runs pylint isolated from everything else.
aleb
added a commit
to aleb/mirrors-pylint
that referenced
this issue
Jan 8, 2020
As described in pre-commit/pre-commit-hooks#157 using this hook runs pylint isolated from everything else.
namanjain
pushed a commit
to square/bionic
that referenced
this issue
Oct 8, 2020
Looks like pre-commit creates its own virtual environment (which shows up in ~/.cache/pre-commit for me). This breaks with flake8 for the new custom linter. It seems like pylint has the same problem with missing modules as I have with flake8, with the missing modules due to different virtualenvs. One of the recommended options from pre-commit devs (found in [this issue](pre-commit/pre-commit-hooks#157)) is to use system language in the hooks to get around this problem. You can find the documentation for system language [here](https://pre-commit.com/#system).
namanjain
pushed a commit
to square/bionic
that referenced
this issue
Oct 8, 2020
Looks like pre-commit does some static analysis by caching packages (which shows up in ~/.cache/pre-commit for me). This breaks with flake8 for the new custom linter. It seems like pylint has the same problem with missing modules as I have with flake8, with the missing modules due to different virtualenvs. One of the recommended options from pre-commit devs (found in [this issue](pre-commit/pre-commit-hooks#157)) is to use system language in the hooks to get around this problem. You can find the documentation for system language [here](https://pre-commit.com/#system).
is a good example, thank you! Also, needed to install pylint
|
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My
.pre-commit-config.yaml
file looks like this: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 showsimport 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??
The text was updated successfully, but these errors were encountered: