是否可以使用自定义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文件,它应该禁止报告和print语句错误:
# 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和旗帜吗?
答案 0 :(得分:2)
CI可以运行不使用pylintrc
的自定义命令:
pylint --errors-only --disable=print-statement test.py