问题
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