Search code examples
pythonpylint

How to set up Pylint to only do some inspections


I'm trying to set up Pylint to only do certain inspections and no others, e.g. only check for W0601 and W0612. I've tried using an enable= line the the [MESSAGES CONTROL] section of my pylint.rc but that doesn't seem to do what I want.

I'm using Pylint 0.25.1.


Solution

  • Looks like a bug with the way rc files are parsed.

    Order matters on the command line (undocumented?) so you need to disable first then enable:

    pylint xyz.py --disable R,C,W,E --enable W0601,W0612
    

    But this is not reflected correctly with --generate-rcfile and does not work with --rcfile ...these are probably bugs. Like #36584.

    In the rc file with the disable line, all messages get disabled, even with disable before enable like on the command line.

    [MESSAGES CONTROL]
    disable=R,C,W,E
    enable=W0601,W0612