pylint: configuration to disable certain warnings

Viewed 3693

I'm trying to use vscode with pylint for my Python needs. It works quite well but one thing I don't like is some of the python complaints. E.g:

  1. Invalid variable names. In short methods or short loops (< 5 lines). I use one character variable names like d for dict and l for line.
  2. Missing doc string.

Coding style argument aside, I'd like an option to turn this off. It looks like I can do this with pylint command line option. But I'd like to make it into configuration that can be reflected in vscode.

How can I do that?

2 Answers

You might want to edit settings.json add the list of rules to ignore, in the attribute python.linting.pylintArgs.

 "python.linting.pylintArgs": [
        "--disable=Cxxxx"
 ],

For example, I am using pep8, and I want to disable E501, as I don't want to restrict to 79 character lines. List of pep8 error codes can be found here.

My settings.json looks like this:

{
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": false,
    "python.linting.pep8Enabled": true,
    "python.linting.pep8Args": [
        "--ignore=E501"
 ],
}

You can refer to vscode documentation on python linting here.

Related