Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the .pylintrc file that VS Code is using for linting?

We have a .pylintrc file committed to git in our project root that is used by our team which has many useful errors disabled. So VS Code doesn't show those. I want to know if I can use my own pylint rules only on my local machine without having to modify the team's .pylintrc file in git.

I know that pylint has an option called --rcfile which can be used to specify custom .pylintrc file. I think if I can specify this option in VS Code settings I can get it to show me more errors. Do you know how to do it?

like image 717
Garry Mccarthy Avatar asked Jan 07 '20 08:01

Garry Mccarthy


2 Answers

If you'd rather have the same .pylintrc enabled for all your environments, you can add to your settings.json the command-line pointer to the config:

    "python.linting.pylintArgs": [
        "--rcfile=${env:HOME}/path/to/your/.pylintrc"
    ]

To keep the same config on Windows and Linux I add HOME=%USERPROFILE% to my User Environment variables on Windows.

like image 118
Leo Avatar answered Nov 15 '22 05:11

Leo


You can create the .pylintrc file in the root directory of your workspace workspace/.pylintrc and it should be automatically detected.

like image 43
Conchylicultor Avatar answered Nov 15 '22 04:11

Conchylicultor