Merge pull request #155 from AD7six/feature/php-no-phpcs-on-parseerror

only run phpcs if the file has no syntax errors.
This commit is contained in:
Martin Grenfell 2012-01-25 03:36:12 -08:00
commit 31970a8ac0

View File

@ -37,13 +37,14 @@ endfunction
function! SyntaxCheckers_php_GetLocList() function! SyntaxCheckers_php_GetLocList()
let errors = [] let errors = []
if !g:syntastic_phpcs_disable && executable("phpcs")
let errors = s:GetPHPCSErrors()
endif
let makeprg = "php -l ".shellescape(expand('%')) let makeprg = "php -l ".shellescape(expand('%'))
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l' let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l'
let errors = errors + SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if empty(errors) && !g:syntastic_phpcs_disable && executable("phpcs")
let errors = errors + s:GetPHPCSErrors()
endif
call SyntasticHighlightErrors(errors, function('SyntaxCheckers_php_Term')) call SyntasticHighlightErrors(errors, function('SyntaxCheckers_php_Term'))