可以在内联注释中指定哪些 pylint 选项?

What pylint options can be specified in inline comments?

我注意到我可以使用评论禁用特定消息。例如,默认情况下 pylint 会抱怨少于三个字母的变量名。我可以这样压制它:

# pylint: disable=invalid-name
def some_string_operation(s):  # (the same thing here would also work)
    return something(s)

但是,例如,我无法将 s 添加到好名录中。这不起作用:

# pylint: good-names=s
def some_string_operation(s):
    return something(s)

很明显,并非所有选项都可以那样修改。哪些可以?

在模块注释中 您只能 enable/disable 特定的 PyLint 检查:

# pylint: disable=wildcard-import, method-hidden
# pylint: enable=too-many-lines