Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enabling pylint_django plugin in vscode, pylint stop working

Tags:

That's my user settings in vscode

{   "python.pythonPath": "/Users/cristiano/miniconda3/envs/django-rest-2/bin/python",   "python.linting.pylintEnabled": true,   "python.linting.enabled": true,   "python.linting.pylintArgs": [     "--load-plugins",     "pylint_django"   ], } 

I installed the plugin via conda, same as the pylint

pylint                    2.1.1                    py36_0 pylint-django             0.11.1                     py_1    conda-forge pylint-plugin-utils       0.4                        py_0    conda-forge 

If i commented out the "python.linting.pylintArgs" section, pylint works with no problem. I ned to enable the plugin to avoid django-specific errros such as "Entity.objects.all()", but if I enable it, the lint stop working: it does not highlight standard errors o warning the previously was doing it.

I have same exact behaviour using vscode for win and mac. I tried also to use the .pylintrc file as described here but I have the same result: lint stop working. Same behaviour using base conda env or a custom one.

like image 830
Crixo Avatar asked Nov 14 '18 15:11

Crixo


People also ask

Why is pylint not working in VSCode?

The problem mostly happens in Linux. You need to make sure pylint is installed in the same environment that VSCode detects. This may be the problem! Open up a terminal and run pip --version , it will tell you the current version of pip and python associated with pip .

How do I enable pylint?

Enable linting# To enable linters, open the Command Palette (Ctrl+Shift+P) and select the Python: Select Linter command. The Select Linter command adds "python. linting. <linter>Enabled": true to your settings, where <linter> is the name of the chosen linter.

How do I disable VSCode Linter?

To disable TSLint in VS Code, we can set the "typescript. validate. enable" setting to false in our VS Code settings. json file.

How do I find my pylint score in VSCode?

pylintrc and put it in the master folder; running Pylint from the command line displays the score.


2 Answers

This config for pylint is working for me:

"python.linting.pylintEnabled": true, "python.linting.pylintArgs": [     "--disable=C0111", // missing docstring     "--load-plugins=pylint_django,pylint_celery",  ], 
like image 160
Manu Avatar answered Oct 07 '22 09:10

Manu


I just got the same issue. Like @J0hnG4lt said, I had a problem with the python path. I didn't point to the path of the environment, which I have installed pylint_django. This config is work for me. Thanks @Manu.

"python.pythonPath": "/Users/mc976/Documents/Programming/Python/Practice/music_service/venv/bin/python3", "python.linting.pylintEnabled": true, "python.linting.pylintArgs": [     "--disable=C0111",     "--load-plugins",     "pylint_django" ] 

Besides, I think you should check your environment to make sure that you have correctly installed pylint_django by using pip list.

like image 44
Thuc Pham Avatar answered Oct 07 '22 08:10

Thuc Pham