Aditya Patel
Aditya Patel

Reputation: 569

Pylint not working when used as pre-commit hook in github

I am trying to use the following pre-commit hook to check my code quality. https://github.com/sebdah/git-pylint-commit-hook

I followed the instruction and installed it but it's displaying me a 0 score for all file. ex.

Running pylint on make_postreq.py (file 5/15).. 0/10.00  FAILED ************* Module make_postreq

Whereas if I run pylint from the console, I get a decent score.

Global evaluation
Your code has been rated at 8.75/10 (previous run: 8.75/10, +0.00)

I feel it might be a configuration issue, but can't seem to make it work. Or is there some other way we can check our Python code quality before committing in GitHub?

Upvotes: 2

Views: 3595

Answers (2)

cmchao
cmchao

Reputation: 86

Try to

  1. set 'reports=yes' in [REPORTS] section
  2. don't disable 'RP0004'

Upvotes: 0

RishiG
RishiG

Reputation: 2830

This issue may be caused by setting the files-output parameter in your pylintrc to yes. I just ran into this where I transferred a configuration file over. The result processing in git-pylint-commit-hook requires that pylint print the final status to stdout, which is suppressed with files-output.

Upvotes: 1

Related Questions