如何在 VSCODE 和 pylama 中全局禁用 E501

All*_* Xu 3 python-3.x visual-studio-code

我正在使用 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"
    ]    
}
Run Code Online (Sandbox Code Playgroud)

但我还是得到了E501。

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

Jon*_*nSG 5

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

python.linting.<linter>Args

所以我建议尝试:

"python.linting.pylamaArgs": [
  "--ignore=E501"
]    
Run Code Online (Sandbox Code Playgroud)

或潜在地

python.linting.pylamaArgs": ["--disable=E501"]
Run Code Online (Sandbox Code Playgroud)

另请参阅: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.
Run Code Online (Sandbox Code Playgroud)