Skip to content

Instantly share code, notes, and snippets.

@scrooloose
Forked from dougireton/chef.vim
Last active December 12, 2015 07:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scrooloose/4737848 to your computer and use it in GitHub Desktop.
Save scrooloose/4737848 to your computer and use it in GitHub Desktop.
function! SyntaxCheckers_chef_foodcritic_IsAvailable()
return executable('foodcritic')
endfunction
function! SyntaxCheckers_chef_foodcritic_GetLocList()
" let exe = expand(g:syntastic_ruby_exec)
" if !has('win32')
" let exe = 'RUBYOPT= ' . exe
" endif
let makeprg = syntastic#makeprg#build({
\ 'exe': 'foodcritic',
\ 'args': '' })
" let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context'
" FC023: Prefer conditional attributes: ./recipes/config.rb:49
let errorformat = '%n: %m: %f:%l'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'chef',
\ 'name': 'foodcritic'})
@scrooloose
Copy link
Author

Hey, saw your message on irc. Check out my fork :)

The name convention is SyntaxCheckers_filetype_name_Function so you have to repeat chef twice here.

@scrooloose
Copy link
Author

Actually, I have just renamed it so that filetype=chef and name=foodcritic.

The point of having names for syntax checkers is to support different checkers for the same filetype - e.g. javascript has jshint, jslint, gjslint, jsl and closurecompiler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment