I'm trying to disable warning C0321 ("more than one statement on a single line" -- I often put
if statements with short single-line results on the same line), in Pylint 0.21.1 (if it matters: astng 0.20.1, common 0.50.3, Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)).
I've tried adding
disable=C0321 in the Pylint configuration file, but Pylint insists on reporting it anyway. Variations on that line (like
disable=C321) are flagged as errors, so Pylint does recognize the option properly, it's just ignoring it.
Is this a Pylint bug, or am I doing something wrong? Is there any way around this? I'd really like to get rid of some of this noise.
pylint --generate-rcfile shows it like this:
[MESSAGES CONTROL] # Enable 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. #enable= # 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=
So it looks like your
~/.pylintrc should have the
disable= line/s in it inside a section
I had this problem using Eclipse and solved it as follows:
in the pylint folder (e.g.
C:\Python26\Lib\site-packages\pylint), hold shift, right-click and choose to open the windows command in that folder. Type:
lint.py --generate-rcfile > standard.rc
This creates the
standard.rc configuration file. Open it in notepad and under
[MESSAGES CONTROL], uncomment
disable= and add the message ID's you want to disable, e.g.:
Save the file, and in Eclipse->window->preferences->PyDev->pylint, in the arguments box, type:
Now it should work ...
You can also add a comment at the top of your code that will be interpreted by pylint:
# pylint: disable=C0321
link to all pylint message codes
--disable-ids=C0321 in the arguments box does not work.
All available pylint messages are stored in the dictionary
_messages, an attribute of an instance of the
pylint.utils.MessagesHandlerMixIn class. When running pylint with the argument
--disable-ids=... (at least without a config file), this dictionary is initially empty, raising a KeyError exception within pylint (
In Eclipse, you can see this error-message in the Pylint Console (windows - show view - Console, select Pylint console from the console options besides the console icon.)