【问题标题】:Pylint not working when used as pre-commit hook in github在 github 中用作预提交挂钩时,Pylint 不起作用
【发布时间】:2015-08-28 11:01:40
【问题描述】:

我正在尝试使用以下预提交挂钩来检查我的代码质量。 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吗?从控制台运行是否覆盖make_postreq.py

标签: python git python-2.7 github


【解决方案1】:

此问题可能是由于将 pylintrc 中的 files-output 参数设置为 yes 导致的。我刚刚遇到了这个问题,我在其中传输了一个配置文件。 git-pylint-commit-hook 中的结果处理要求pylint 将最终状态打印到标准输出,而files-output 会抑制。

【讨论】:

【解决方案2】:

尝试

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-28
    • 2019-02-28
    • 1970-01-01
    相关资源
    最近更新 更多