5

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?

lang2
  • 11,433
  • 18
  • 83
  • 133
  • pylint has a command line option `--rcfile=[filename]` that lets you customize lots of things with a config file. The default file is huge but reasonably well documented. – Paul Cornelius May 13 '17 at 03:21

2 Answers2

4

I found this answer helpful on setting up a config file.

Basically, add the following to a .pylintrc file in your home directory.

[MESSAGES CONTROL]
disable=C0103
alex
  • 41
  • 3
4

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.

Bala TJ
  • 700
  • 6
  • 10