我怎么能忽略一个lint错误的一行与崇高的文本3 Anaconda?

时间:2021-01-19 17:27:50

I'm using Anaconda with Sublime text 3. I have left the lint settings as default with the exception of the following overrides which I've included in a .sublime-project file.

我用的是一条具有崇高文本的蟒蛇。除了我在.sublime-project文件中包含的以下重写外,我将lint设置保留为默认设置。

"settings": {
        "anaconda_gutter_marks": true,
        "anaconda_gutter_theme": "alpha",
        "anaconda_linting_behaviour": "always",

    }

I'd like to be able to ignore "line too long" for certain lines, specifically ones with urls in the comments. I like having it for other lines so I would rather not disable it entirely.

我希望能够对某些行忽略“行太长”,特别是在注释中带有url的行。我喜欢它用于其他行,所以我不希望完全禁用它。

I've only found information on doing this for pylint but I'd rather use the default linter if that is possible since that seems to come with its own issues in this plugin.

我只找到了关于pylint的信息,但是如果有可能的话,我宁愿使用默认的linter,因为这在这个插件中似乎有它自己的问题。

I've included the sublimelinter tag because anaconda states it's linting is based off of that plugin.

我包含了sublimelinter标签,因为anaconda声明它的linting是基于那个插件的。

3 个解决方案

#1


5  

As of today (Oct 15, 2017), it appears to me that you can use the # noqa syntax with Anaconda for Sublime Text 3. For line too long, you would add # noqa E501 to the end of the line.

从今天(2017年10月15日)开始,在我看来,您可以使用# noqa语法和Anaconda用于崇高的文本3。对于太长的行,您将在行尾添加# noqa E501。

Example:

例子:

shipping_account = models.ForeignKey(Account, related_name='order_shipping_set') # noqa E501

#2


53  

To disable lints for specific errors, go to the Anaconda.sublime-settings file (Preferences > Packages Settings > Anaconda > Settings). There you will find several options depending on which linter you are using.

要禁用特定错误的lints,请转到Anaconda。sublime-settings文件(Preferences > package Settings > Anaconda > Settings)。在那里,您将找到几个选项,这取决于您使用的是哪种衬线。

For example, to disable linting for "line too long" for pep8, fill in the following:

例如,要禁用pep8“过长”的linting,请填写以下内容:

"pep8_ignore":
[
    "E501"
],

Also, the easiest way to find out the correct error code is to the view the lint error itself at the bottom of the screen.

另外,找到正确错误代码的最简单方法是查看屏幕底部的lint错误本身。

#3


11  

I am afraid that you can't ignore an error type (like line too long) just for some lines. You can't disable just warnings or violations neither.

我担心您不能只对某些行忽略错误类型(比如行太长)。你不能只禁用警告或违规。

It would be possible to implement some custom system like the #noqa comment in flake8 to make the plugin able to just ignore certain lines of code but this has to be implemented as it's not supported by the plugin and there are no plans to use flake8 in replacement of PyFlakes and pep8 that are already being used by separate.

有可能实现一些自定义系统的# noqa评论flake8使插件能够无视某些行代码,但这必须实现为不支持的插件和没有计划使用flake8替换PyFlakes和pep8已经被分开。

There is a similar (but in a much more abstract way) request already in the issues in the GitHub project, you can find it here https://github.com/DamnWidget/anaconda/issues/142

GitHub项目中已经有一个类似的(但以一种更抽象的方式)请求,您可以在这里找到它:https://github.com/DamnWidget/anaconda/issues/142

#1


5  

As of today (Oct 15, 2017), it appears to me that you can use the # noqa syntax with Anaconda for Sublime Text 3. For line too long, you would add # noqa E501 to the end of the line.

从今天(2017年10月15日)开始,在我看来,您可以使用# noqa语法和Anaconda用于崇高的文本3。对于太长的行,您将在行尾添加# noqa E501。

Example:

例子:

shipping_account = models.ForeignKey(Account, related_name='order_shipping_set') # noqa E501

#2


53  

To disable lints for specific errors, go to the Anaconda.sublime-settings file (Preferences > Packages Settings > Anaconda > Settings). There you will find several options depending on which linter you are using.

要禁用特定错误的lints,请转到Anaconda。sublime-settings文件(Preferences > package Settings > Anaconda > Settings)。在那里,您将找到几个选项,这取决于您使用的是哪种衬线。

For example, to disable linting for "line too long" for pep8, fill in the following:

例如,要禁用pep8“过长”的linting,请填写以下内容:

"pep8_ignore":
[
    "E501"
],

Also, the easiest way to find out the correct error code is to the view the lint error itself at the bottom of the screen.

另外,找到正确错误代码的最简单方法是查看屏幕底部的lint错误本身。

#3


11  

I am afraid that you can't ignore an error type (like line too long) just for some lines. You can't disable just warnings or violations neither.

我担心您不能只对某些行忽略错误类型(比如行太长)。你不能只禁用警告或违规。

It would be possible to implement some custom system like the #noqa comment in flake8 to make the plugin able to just ignore certain lines of code but this has to be implemented as it's not supported by the plugin and there are no plans to use flake8 in replacement of PyFlakes and pep8 that are already being used by separate.

有可能实现一些自定义系统的# noqa评论flake8使插件能够无视某些行代码,但这必须实现为不支持的插件和没有计划使用flake8替换PyFlakes和pep8已经被分开。

There is a similar (but in a much more abstract way) request already in the issues in the GitHub project, you can find it here https://github.com/DamnWidget/anaconda/issues/142

GitHub项目中已经有一个类似的(但以一种更抽象的方式)请求,您可以在这里找到它:https://github.com/DamnWidget/anaconda/issues/142