Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I ignore a lint error for a line with Sublime Text 3 Anaconda?

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.

"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.

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.

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

like image 756
Daniel Rucci Avatar asked May 06 '14 16:05

Daniel Rucci


People also ask

How do I enable lint in Sublime Text?

You can install any package control in Sublime Text editor using the shortcut key combination Ctrl+Shift+P, and selecting the Package Control: Install Package option. Select the associated package to install in Sublime Text editor. To install Sublime Linter, you need to select the option of SublimeLinter plugin.

What is linting in sublime text editor?

Linting is the process of checking your code for potential errors. This could be either the syntax or the code style. The linting process can be done during three stages of development: Via your editor (live linting)

How do I turn off SublimeLinter?

To do so, bring up the Command Palette and type disable . Among the commands you should see SublimeLinter: Disable Linting . If that command is not highlighted, use the keyboard or mouse to select it. Once you do this, all linters are disabled and all error marks are cleared from all views.

How do I show errors in Sublime Text 3?

How do I show errors in Sublime Text? At the bottom of the Sublime Text Tools menu, you will see a SublimeLinter submenu. Select SublimeLinter > Next Error , SublimeLinter > Previous Error , or SublimeLinter > Show All Errors .


2 Answers

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.

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

"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.

like image 160
Craig Fisher Avatar answered Oct 08 '22 05:10

Craig Fisher


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.

Example:

shipping_account = models.ForeignKey(Account, related_name='order_shipping_set') # noqa E501 
like image 31
Nostalg.io Avatar answered Oct 08 '22 04:10

Nostalg.io