我正在尝试使用以下预提交 Hook 来检查我的代码质量。 https://github.com/sebdah/git-pylint-commit-hook
我按照说明安装了它,但它显示所有文件的分数为 0。例如。
Running pylint on make_postreq.py (file 5/15).. 0/10.00 FAILED ************* Module make_postreq
而如果我从控制台运行 pylint
,我会得到不错的分数。
Global evaluation
Your code has been rated at 8.75/10 (previous run: 8.75/10, +0.00)
我觉得这可能是配置问题,但似乎无法正常工作。 或者在提交到 GitHub 之前,我们可以通过其他方式检查我们的 Python 代码质量吗?
最佳答案
此问题可能是由于将 pylintrc 中的 files-output
参数设置为 yes
引起的。我刚刚在传输配置文件的地方遇到了这个问题。 git-pylint-commit-hook
中的结果处理要求 pylint
将最终状态打印到 stdout,它被 files-output
抑制。
关于python - 在 github 中用作预提交 Hook 时 Pylint 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32269535/