Spaceship222
Spaceship222

Reputation: 849

How can I make flake8 only detect errors?

I use flake8 as python linter in vscode. I want flake8 to ignore all warning, but I can't find any option to detect error-only after searching flake8 documentation. So, how can I achieve this? Any help?

Upvotes: 8

Views: 6410

Answers (2)

anthony sottile
anthony sottile

Reputation: 69844

though flake8 has things that are marked "E" and "F" and "W" they don't stand for "error" / "failure" / "warning". these are codes for particular plugins ("E" / "W" are pycodestyle, "F" is pyflakes)

if you want to exclude a particular set of warnings, you'd use the --extend-ignore=X argument (or the --ignore=X argument, though the former is preferable since it doesn't reset the default set of ignores).

It's usually easier to set this in a flake8 configuration file (tox.ini / setup.cfg / .flake8) such that others can take advantage of this setting without needing to use your IDE-specific setting.

[flake8]
extend-ignore = X, Y, Z

If you know you only want a particular set of codes, you can also utilize --select

[flake8]
select = F,E

disclaimer: I am the current maintainer of flake8

Upvotes: 9

Dauren Akilbekov
Dauren Akilbekov

Reputation: 5015

Add following settings to settings.json:

Upvotes: 0

Related Questions