Visual Studio 代码抑制 pep8 警告 [英] Visual studio code suppress pep8 warnings

查看:35
本文介绍了Visual Studio 代码抑制 pep8 警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Visual Studio 代码中抑制 pep8 警告?我想要做的是抑制 E501 警告我不想收到我的代码长度超过 80 个字符的警告.我正在使用 Don Jayamanne 的 Python 扩展,这是我的 vscode 配置文件

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. I'm using Don Jayamanne's Python extension and here is my config file for vscode

{
    "python.linting.pylintEnabled": false,
    "python.linting.pep8Enabled": true,
    "python.pythonPath": "/workspace/virtualenvs/abr/bin/python3",
    "python.linting.enabled": true
}

我知道还有另一种选择 "python.linting.pep8Args": [] 但我无法让它工作.我已经在 virtualenv 上安装了 pep8

I know that there is one another option "python.linting.pep8Args": [] but I couldn't to get it work. I've installed pep8 on virtualenv

我已经尝试过的.

  1. "python.linting.pep8Args": ['--ignore=E501']
  2. 搜索了所有 Visual Studio 代码设置"

推荐答案

对单个项目使用 setup.cfg 或更改所有 py 文件的用户设置.

Either use setup.cfg for single project or change your user settings for all py files.

{
    "python.linting.pycodestyleEnabled": true,
    "python.linting.pycodestyleArgs": [
        "--ignore=E501" 
    ]
}

2019 年 10 月之前 所有 pycodestyle 设置都被命名为 pep8:

Before October 2019 all pycodestyle settings were named pep8:

{
    "python.linting.pep8Enabled": true,
    "python.linting.pep8Args": [
        "--ignore=E501" 
    ]
}

这篇关于Visual Studio 代码抑制 pep8 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆