【问题标题】:How to to globally disable E501 in VSCODE and pylama如何在 VSCODE 和 pylam 中全局禁用 E501
【发布时间】:2021-04-21 22:30:05
【问题描述】:

我正在使用 Visual Studio Code 和 pylama linter。

目前我在每一行都添加了# noqa,以避免出现以下 linter 消息:

line too long (100 > 79 characters) [pycodestyle]pylama(E501)

我已将"--disable=E501" 添加到VSCODE 的工作区settings.json 文件中,如下所示:

{
    "editor.tabSize": 2,
    "editor.detectIndentation": false,
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": false,
    "python.linting.flake8Enabled": false,
    "python.linting.pycodestyleEnabled": false,
    "python.linting.pylamaEnabled": true,
   
    "[python]": {
      "editor.tabSize": 4
    },
    "python.linting.pylama": [
      "--disable=E501"
    ]    
}

但我仍然得到 E501。

如何在我的 VSCODE 工作区中永久禁用 E501?

【问题讨论】:

  • 试试python.linting.pylamaArgs,因为这符合 pylint args 的指定方式。
  • @JonSG,解决了这个问题。谢谢!。正确的设置是 "python.linting.pylamaArgs": [ "--ignore E501" ] .
  • @JonSG,请创建一个答案,以便我标记它。

标签: python-3.x visual-studio-code


【解决方案1】:

对于其他 linter,.settings 文件似乎正在寻找

python.linting.<linter>Args

所以我建议尝试:

"python.linting.pylamaArgs": [
  "--ignore=E501"
]    

或可能

python.linting.pylamaArgs": ["--disable=E501"]

另请参阅:https://code.visualstudio.com/docs/python/settings-reference#_pylama

这似乎表明相同:

pylamaArgs  []  Additional arguments for pylama, where each top-level element that's separated by a space is a separate item in the list.

【讨论】:

    猜你喜欢
    • 2020-08-07
    • 2017-09-20
    • 2020-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-06
    • 2020-03-16
    • 1970-01-01
    相关资源
    最近更新 更多