Get rid of annoying warnings like F403 and F405 when using VS Code and flake8

When using VS Code and flake8, code like from module import * will result in warnings F403 and F405.

But I really need from module import *, and I don't want to fix it with stupid comments every time there's a warning. Is there a way to get rid of such warnings once and for all?

Update VS Code settings

Open VS Code's settings page, and search flake8.args, press Add Item and input the following content:

--ignore=F403,F405

Then the limit will be 120 characters.

Update VS Code configuration file

If you prefer to edit json file directly, use this:

{
    "flake8.args": [
        "--ignore=F403,F405"
    ]
}

Notice

python.linting.flake8Args was used in the past and now you should use flake8.args instead.

According to Migration to Python Tools Extensions, the VS Code team migrated flake8 realted stuff to an extension. This migration caused the changes of flake8 related configuration keys.

Posted on 2023-10-13