From b21ddb52835c88b3ae89e230f4aaa5ff5d7264fd Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Tue, 6 Dec 2011 17:25:40 -0600 Subject: [PATCH] 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. --- syntax_checkers/php.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/php.vim b/syntax_checkers/php.vim index 819d7590..6cf5e689 100644 --- a/syntax_checkers/php.vim +++ b/syntax_checkers/php.vim @@ -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