可以在内联注释中指定哪些 pylint 选项? [英] What pylint options can be specified in inline comments?
本文介绍了可以在内联注释中指定哪些 pylint 选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我注意到我可以使用评论禁用特定消息.例如,默认情况下,pylint 会抱怨变量名少于三个字母.我可以像这样抑制它:
I note that I can disable particular messages using a comment. For example, pylint by default complains about variable names of less than three letters. I can suppress that like this:
# pylint: disable=invalid-name
def some_string_operation(s): # (the same thing here would also work)
return something(s)
但是,例如,我不能将 s
添加到好名字列表中.这不起作用:
But I cannot, for example, add s
to the good-names list. This doesn't work:
# pylint: good-names=s
def some_string_operation(s):
return something(s)
很明显,并非所有选项都可以这样修改.哪些可以?
So clearly not all options can be modified that way. Which ones can?
推荐答案
在模块注释中您只能启用/禁用特定的 PyLint 检查:
# pylint: disable=wildcard-import, method-hidden
# pylint: enable=too-many-lines
这篇关于可以在内联注释中指定哪些 pylint 选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文