Visual studio code suppress pep8 warnings

后端 未结 10 1278
滥情空心
滥情空心 2021-01-31 14:52

How can I suppress pep8 warnings, in Visual studio code? What I want to do is to suppress E501 warning I don\'t want to get warnings where my code length is more than 80 chars.

相关标签:
10条回答
  • 2021-01-31 15:21

    I was fighting with this a couple of weeks ago. What I ended up doing was adding a setup.cfg file into the root folder of my project and putting the following in it:

    [pep8]
    ignore = E501
    
    0 讨论(0)
  • 2021-01-31 15:23

    Please try double qoute " instead of single '

    ['--ignore=E501'] --> ["--ignore=E501"]

    It worked for me. Don't forget to restart the program.

    0 讨论(0)
  • 2021-01-31 15:23

    In case you are not using flake8Args but Pylama (for example) the configuration change on settings.json is similar as described before: "python.linting.pylamaArgs": ["--max_line_length=120"] or "python.linting.pylamaArgs": [""--ignore=E501" "]

    0 讨论(0)
  • 2021-01-31 15:24

    What you did is correct. However you have to start the VScode to see the difference. (I would prefer vs auto update itself.)

    0 讨论(0)
  • 2021-01-31 15:26

    If you want to change the line length, add this in your User Settings file

    { 
      "python.linting.pep8Enabled": true,
      "python.linting.pep8Args": ["--max-line-length=120" ]
    }
    

    previous code was giving me 'EOF' error, so i edited it

    0 讨论(0)
  • 2021-01-31 15:26

    What worked for me was adding the code snippet below to my user settings.json file. This was mentioned above but without the settings.json.

    "python.linting.flake8Enabled": true,
    "python.linting.flake8Args": ["--ignore=E501"]
    
    0 讨论(0)
提交回复
热议问题