With pylint, you can ignore individual errors, warnings, etc. on a line by using a special comment of the format: # pylint: disable={comma-separated-list-of-names-or-codes}
class MyFavoriteClass():
def __init__(self):
self.counter = 0
def memberFunction(self):
self.counter = self.counter + 1
myinstance = MyFavoriteClass() # pylint: disable=invalid-name
myinstance.memberFunction()
Or, you can specify a list of message codes to ignore in the pylint config file:
[MESSAGES CONTROL]
# 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=invalid-name
# OR
disable=C0103
NOTE: Disabling a code from the config file will ignore it globally. If you want to just ignore it on a specific line, you'll have to use the special comment mentioned at the beginning.
The pylint config file is determined by first checking the PYLINTRC
environment variable. If that does not provide a file, then ~/.pylintrc
and /etc/pylintrc
are checked consecutively.
If you can control the pylint command being executed, you can also specify the config using the --rcfile
parameter.
If you'd like to generate a sample config, run:
pylint --generate-rcfile
Additionally, if you disable a code, that will trigger locally-disabled (I0011)
which itself can also disabled (ideally in the config).