我正在尝试在 Pylint 中禁用警告 C0321(“单行上有多个语句”——我经常将具有短单行结果的 if
语句放在同一行) 0.21.1(如果重要:astng 0.20.1、common 0.50.3 和 Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56))。
我尝试在 Pylint 配置文件中添加 disable=C0321
,但 Pylint 还是坚持要报告。该行的变体(如 disable=0321
或 disable=C321
)被标记为错误,因此 Pylint 确实正确识别该选项。它只是忽略它。
这是一个 Pylint 错误,还是我做错了什么?有没有办法解决这个问题?
我真的很想摆脱这些噪音。
最佳答案
pylint --generate-rcfile
显示如下:
[MESSAGES CONTROL]
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time.
#enable=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).
#disable=
所以看起来您的 ~/.pylintrc
应该在 [MESSAGES CONTROL]
部分中包含 disable=
行/s .
https://stackoverflow.com/questions/4341746/