What pylint options can be specified in inline comments?

荒凉一梦 提交于 2021-02-07 05:20:31

问题


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)

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?


回答1:


In the module comments you can only enable/disable specific PyLint checks:

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


来源:https://stackoverflow.com/questions/34803567/what-pylint-options-can-be-specified-in-inline-comments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!