python - 在 github 中用作预提交 Hook 时 Pylint 不起作用

标签 python git python-2.7 github

我正在尝试使用以下预提交 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/

相关文章:

git - 使用具有非标准端口的远程存储库

python - (找不到)python 可数属性 most_common()

python - 在 Python 中将 ISO 8601 日期时间转换为秒

python - Flask request.remote_addr 在 webfaction 上是错误的并且没有显示真实的用户 IP

git - 如何使用git查看另一个开发者的分支?

python - 如何让 Python 找到 `libusb` ? `pyusb` 后端需要它

git - 字幕创建的版本控制

python - 带有模型的 Django QuerySet

python - pyenv-virtualenv : `3.6.4' is not installed in pyenv

python - 在不同的函数中多次读取文本文件并在Python的一个主函数中访问这些函数