python - 如何禁用 Pylint 警告?

我正在尝试在 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=0321disable=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/

相关文章:

linux - 如何计算文档中的行数?

python - 如何从 Pandas 数据框中删除行列表?

python - 如何反转 x 或 y 轴

python - pip 在哪里安装它的包?

linux - 删除目录的符号链接(symbolic link)

linux - 将多个 PDF 文件合并/转换为一个 PDF

c - 为什么 C 预处理器将单词 "linux"解释为常量 "1"?

linux - 如何在 Linux 上使用 grep 仅显示文件名?

python - 在 Python 中创建一个空列表

linux - 定义带或不带导出的变量