How do I get flake8 to reliably ignore rules in VS Code?

后端 未结 2 1627
轮回少年
轮回少年 2021-01-30 03:11

Two things that annoy me. First is the warning Flake8 gives me when I type more than 80 characters on a line. Second is the warnings I get when I haven\'t yet used a module name

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 03:36

    note that flake8 uses

    "python.linting.flake8Args": [
    

    whereas black seems to use:

    "python.formatting.blackArgs": [
    

    if you're using both (or toggling) these settings maybe helpful:

        {
            "python.linting.pylintEnabled": false,
            "python.linting.flake8Enabled": true,
            "python.linting.enabled": true,
            "python.formatting.provider": "black",
            "python.formatting.blackArgs": [
                "--line-length",
                "120"
            ],
            
            "python.linting.flake8Args": [
                "--max-line-length=120",
                "--ignore=E402",
            ],
        
            "python.pythonPath": "venv/bin/python"
        }
    
    

提交回复
热议问题