Added g:syntastic_phpcs_conf to allow phpcs flags.

PHPCS has a wide variety of commandline flags, including
support for various syntaxes. These must be configurable,
otherwise phpcs generates a high number of spurious errors for
code written to any standard other than the PEAR standard.
This commit is contained in:
Matt Butcher 2011-12-06 17:25:40 -06:00 committed by Martin Grenfell
parent b96617994b
commit b21ddb5283

View File

@ -29,7 +29,16 @@ function! SyntaxCheckers_php_GetLocList()
let errors = []
if executable("phpcs")
let makeprg = "phpcs --report=csv ".shellescape(expand('%'))
" Support passing configuration directives to phpcs through
" g:syntastic_phpcs_conf. This matches the method in the javascript.vim
" setup.
if !exists("g:syntastic_phpcs_conf") || empty(g:syntastic_phpcs_conf)
let phpcsconf = ""
else
let phpcsconf = g:syntastic_phpcs_conf
endif
let makeprg = "phpcs " . phpcsconf . " --report=csv ".shellescape(expand('%'))
let g:mpb_makeprg = makeprg
let errorformat = '"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endif