hooks: pylint: pre-commit failure

See original GitHub issue

.pre-commit-config.yaml states that the pylint hook is defined locally, yet .pre-commit-hooks.yaml fails to define it. As a result, attempting to commit will result in an error:

~/gits/dvc (master)$ git commit
black....................................................................Passed
seed isort known_third_party.............................................Passed
isort....................................................................Passed
flake8...................................................................Passed
pylint...................................................................Failed
- hook id: pylint
- exit code: 1

Executable `pylint` not found

beautysh.............................................(no files to check)Skipped
DVC pre-commit...........................................................Passed
- hook id: dvc-pre-commit
- duration: 0.5s

Data and pipelines are up to date.

Defining the hook’s language as system and asking devs to manually run pip install .[tests] goes against fundamental principles of pre-commit hooks. None of the other hooks require this.

In any case pylint itself defines .pre-commit-hooks.yaml so we should just use theirs.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
efiopcommented, Jul 15, 2020

Ok, so looks like “do nothing” is the choice for now. Closing.

2reactions
skshetrycommented, Jul 14, 2020

I see @casperdcl suggested using init hook in #4146 (comment)

I don’t like that approach/hack, it’s far easier to pre-activate virtualenv. And, it does not solve the issue, it still needs all of the tests dependencies to be installed.

The possible ways to solve this are:

  1. Remove pylint from pre-commit altogether. Add a guide to how-to run pylint in contributing docs.
  2. Create a wrapper script that’d be a no-op if pylint is not installed.
  3. Do nothing.
  4. Make it a pre-push hooks?

I don’t have any strong opinions on either of the above. If we cannot commit to anything, I’d suggest we close the issue and defer it for later.

cc @casperdcl @efiop

Read more comments on GitHub >

github_iconTop Results From Across the Web

pylint and pre-commit hook unable to import - Stack Overflow
pre-commit runs pylint from an isolated virtualenv. Many of pylint's checks perform dynamic analysis which will fail there.
Read more >
Pre-commit integration - Pylint 2.16.0-dev documentation
pylint can be used as a pre-commit hook. Since pylint needs to import modules and dependencies to work correctly, the hook only works...
Read more >
Setup Pylint pre-commit hook - Moserei
A short guide on the Pylint hook for pre-commit. ... When you try to commit this, pylint will fail and stop you from...
Read more >
Supported hooks - pre-commit
python -import-sorter - This hook sorts python imports. ... puppet-lint - Check Puppet manifests for stylistic problems; puppet-validate - Validate syntax of ...
Read more >
Keep your code clean using Black & Pylint & Git Hooks & Pre ...
Create the file pre-commit in the folder .git/hooks/. You should not include any ... help='score threshold to fail pylint runner | '
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found