Selva
Selva

Reputation: 1153

How to enable linting for flake8 plugins in VSCode?

I am having flake8 installed and VSCode is able to detect default checks with the squiggly lines. Now, I installed flake8-docstring but VSCode is not warning on missing docstring.

For example, running below command in powershell, gives expected output.

>> python flake8 abc.py
abc.py:1:1: D100 Missing docstring in public module

But in VSCode, it is not showing the squiggly lines.

Upvotes: 5

Views: 1964

Answers (3)

neves
neves

Reputation: 39153

I answered it here.

You must configure the extension to use your installed Flake8. Do it in your settings.json with: "flake8.importStrategy": "fromEnvironment",

See the answer above for more details.

Upvotes: 0

JialeDu
JialeDu

Reputation: 9727

Different linter will produce different effects, it is recommended that you use pylint.

  1. First enable linting

    enter image description here

  2. Then select pylint

    enter image description here

  3. Effect

    enter image description here

Upvotes: -1

Kawish Qayyum
Kawish Qayyum

Reputation: 181

In VSCode, press Ctrl + Shift + P, and type Select Linter:

Select Linter

Then select the linter of your choice, e.g flake8: Choose linter

Hope this helps!

Upvotes: -1

Related Questions