Merge branch 'master' of git://github.com/scrooloose/syntastic

Conflicts:
	syntax_checkers/php.vim
This commit is contained in:
Matt Butcher 2011-12-07 09:16:25 -06:00
commit 7db6cddd16
2 changed files with 21 additions and 20 deletions

View File

@ -23,12 +23,12 @@ if !s:running_windows
let s:uname = system('uname')
endif
if !exists("g:syntastic_enable_signs") || !has('signs')
let g:syntastic_enable_signs = 1
if !exists("g:syntastic_enable_signs")
let g:syntastic_enable_signs = has('signs')? 1 : 0
endif
if !exists("g:syntastic_enable_balloons") || !has('balloon_eval')
let g:syntastic_enable_balloons = 1
if !exists("g:syntastic_enable_balloons")
let g:syntastic_enable_balloons = has('balloon_eval')? 1 : 0
endif
if !exists("g:syntastic_auto_loc_list")

View File

@ -19,6 +19,15 @@ if !executable("php")
finish
endif
"Support passing configuration directives to phpcs
if !exists("g:syntastic_phpcs_conf")
let g:syntastic_phpcs_conf = ""
endif
if !exists("g:syntastic_phpcs_disable")
let g:syntastic_phpcs_disable = 0
endif
function! SyntaxCheckers_php_Term(item)
let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'")
if len(unexpected) < 1 | return '' | end
@ -28,22 +37,8 @@ endfunction
function! SyntaxCheckers_php_GetLocList()
let errors = []
let no_phpcs = exists("g:syntastic_phpcs_disable") && g:syntastic_phpcs_disable
" Run phpcs if it is found, and if it is not disabled.
if executable("phpcs") && !no_phpcs
" 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 errorformat = '"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if !g:syntastic_phpcs_disable && executable("phpcs")
let errors = s:GetPHPCSErrors()
endif
let makeprg = "php -l ".shellescape(expand('%'))
@ -54,3 +49,9 @@ function! SyntaxCheckers_php_GetLocList()
return errors
endfunction
function! s:GetPHPCSErrors()
let makeprg = "phpcs " . g:syntastic_phpcs_conf . " --report=csv ".shellescape(expand('%'))
let errorformat = '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction