在github

时间:2015-08-28 11:01:40

标签: python git python-2.7 github

我正在尝试使用以下预提交挂钩来检查我的代码质量。 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代码质量吗?

2 个答案:

答案 0 :(得分:1)

将您的pylintrc中的files-output参数设置为yes可能会导致此问题。我刚刚碰到了我转移配置文件的地方。 git-pylint-commit-hook中的结果处理要求pylint将最终状态打印到stdout,并使用files-output进行抑制。

答案 1 :(得分:0)

尝试

  1. 在[REPORTS]部分设置'reports = yes'
  2. 不要禁用'RP0004'