【发布时间】:2015-02-09 19:13:21
【问题描述】:
是否可以使用自定义 rcfile 和仅错误标志运行 pylint?我希望 pylint 在典型用法中报告警告,但是当检查在我们的 CI 服务器上运行时,我想使用 --errors-only。
例如,假设我有 test.py:
"""test.py -- a test of pylint's error-handling."""
def some_method():
"""Just a method."""
print 'hi'
return 2
还有一个自定义 pylintrc 文件,它应该禁止报告和打印语句错误:
# custom-pylintrc
[REPORTS]
# Disable the reporting and just show messages.
reports=no
[MESSAGES CONTROL]
disable=print-statement
当我单独使用 pylintrc 文件时,我没有收到任何错误,但传递标志会显示一个错误,我预计会被 rcfile 抑制。
$ pylint test.py --rcfile=custom-pylintrc # passes with no output
$ pylint test.py --rcfile=custom-pylintrc --errors-only
************* Module test
E: 5, 4: print statement used (print-statement)
我想我也想吃蛋糕——我可以使用 rcfile 和一个标志吗?
【问题讨论】:
-
您也可以为 CI 提供一个单独的 rc 文件,作为一种解决方法。