【问题标题】:"SublimeAutoPep8: some issue(s) were not fixed" such as E501“Sublime AutoPep8:一些问题)未修复”,例如 E501
【发布时间】:2020-08-01 03:41:24
【问题描述】:

我在 Python 中收到一个软警告:

SublimeAutoPep8: some issue(s) were not fixed:
File "/Library/WebServer/dir/dir/filename.py", line 11: not fixed E501
File "/Library/WebServer/dir/dir/filename.py", line 33: not fixed E501

我现在的AutoPep8.sublime-settings是:

{
    "format_on_save": true,
     "max-line-length": 100,
}

我尝试在Preferences.sublime-settings 中添加以下配置:

    "pep8": {
        "@disable": false,
        "args": [],
        "excludes": [],
        "ignore": [ "E251", "W291", "E501" ],
        "max-line-length": null,
        "select": ""
    },

似乎不对。

我应该怎么做才能忽略这些警告?谢谢!

【问题讨论】:

    标签: sublimetext3 sublimetext sublime-text-plugin


    【解决方案1】:

    首先,您不应将 AutoPep8 设置添加到 Preferences.sublime-settings 中,而是应将它们全部添加到 AutoPep8.sublime-settings 文件中,该文件应位于 Sublime Text User 配置目录中。

    其次,我认为您可能混淆了 2 个不同的 Sublime Text 包的设置,它们是 Auto​PEP8Python PEP8 Autoformat。鉴于您提到的警告消息,假设您安装了AutoPep8 似乎是合理的,但您显示的设置是两个包的组合,请参阅默认的AutoPep8.sublime-settings 文件和默认的pep8_autoformat.sublime-settings 文件。两个包都有一个ignore 设置,但Python PEP8 Autoformat 包需要一个字符串列表,这是你使用的,而AutoPep8 包需要一个逗号分隔值的字符串,我认为你应该使用它。

    您应该能够使用 Sublime Text 菜单打开您的用户 AutoPep8.sublime-settings 文件:

    Menu --> Preferences --> Package Settings --> AutoPep8 --> Settings – User
    

    我建议你试试这些AutoPep8.sublime-settings 设置:

    {
        "format_on_save": true,
        "max-line-length": 100,
        // Crucially "ignore" uses a string with comma
        // separated values and not a list of strings.
        "ignore": "E251, W291, E501"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-05
      • 2019-01-12
      • 2012-10-14
      • 1970-01-01
      • 2019-04-17
      相关资源
      最近更新 更多