How can I turn off specific messages in syntastic (vim)?

Turn off multiple kinds of warnings in syntastic in vim:

Add this line to your .vimrc

let g:syntastic_quiet_messages = { 'regex': 'SC2148\|SC1234\|SC6789' }

Also you can do it against the message itself like this:

let g:syntastic_quiet_messages = { "regex": 'superfluous-parens\|too-many-instance-attributes\|too-few-public-methods' }

The Devil is in the details:

  1. the variable is actually called g:syntastic_quiet_messages
  2. the error is actually SC2148
  3. you probably don't want to disable syntax messages.

Thus:

let g:syntastic_quiet_messages = { 'regex': 'SC2148' }

Or just:

let g:syntastic_sh_shellcheck_args = '-e SC2148'

Agree with accepted answer, but wished to add some extra context.

You can run :h syntastic_quiet_messages to get the official docs with explanation of the commands.

You can use syntastic_quiet_messages or, if you have a particular filetype and checker, then use syntastic_<filetype>_<checker>_quiet_messages.

Here is a snippet from my .vimrc:

" keep some globals quiet
let g:syntastic_javascript_standard_quiet_messages = { 'regex': ['alert',
                                            \ 'localStorage',
                                            \ 'auth0js',
                                            \ 'auth0'] }

Above, I am keeping global errors quiet, and use an array to list more than one item. Only wish to apply this to javascript files, using the standard style lint checker.

Tags:

Vim

Syntastic