【问题标题】:Ignore pep8(E501) in comments using visual studio code使用 Visual Studio 代码在评论中忽略 pep8(E501)
【发布时间】:2019-11-17 19:17:05
【问题描述】:

如何使用 Visual Studio 代码忽略 Python cmets 中的 pep8 (E501)。我需要的是忽略 Python cmets 中的警告,而不是 Python 代码中的警告。似乎将 python.linting.pep8Enabled 设置为 false 将忽略所有警告。如何自定义我的 setting.json?

【问题讨论】:

    标签: visual-studio-code pep8


    【解决方案1】:

    看起来我遇到了同样的问题,我用过

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

    在我的 settings.json 中忽略它。

    【讨论】:

    • 但它会忽略包括源代码在内的所有 E501 警告,我只需要忽略 cmets。
    【解决方案2】:

    我的 cmets 通常以 noqa: E501 开头。

    例如:

    # noqa: E501 - Here, I can write my inline comment with more than 79 characters.
    

    【讨论】:

      猜你喜欢
      • 2017-04-11
      • 2011-05-02
      • 1970-01-01
      • 2023-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-04
      • 1970-01-01
      相关资源
      最近更新 更多