From 4fd426cd4fc822f76938f550877bafcb3909e4f9 Mon Sep 17 00:00:00 2001 From: Jon Cairns Date: Fri, 11 May 2012 14:20:02 +0100 Subject: [PATCH] Code coverage efficiency improvements and options Also, there's now an option to turn off automatic location list opening with mess detector/code sniffer violations. --- autoload/phpqa.vim | 44 ++++++++++++++++++---------------- plugin/phpqa.vim | 15 +++++++++++- plugin/python/codecoverage.vim | 20 ++++++++++++++-- 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/autoload/phpqa.vim b/autoload/phpqa.vim index 2718543..4111e7e 100644 --- a/autoload/phpqa.vim +++ b/autoload/phpqa.vim @@ -83,27 +83,29 @@ endf " Run the PHP linter to check for syntax errors function! phpqa#PhpLint() - if 0 != len(g:phpqa_php_cmd) - let l:bufNo = bufnr('%') - call s:RemoveSigns() - let l:php_output=system(g:phpqa_php_cmd." -l ".@%." 1>/dev/null") - let l:php_list=split(l:php_output, "\n") - if 0 != len(l:php_list) - let l:php_list[0] = "P ".l:php_list[0] - set errorformat=%t\ %m\ in\ %f\ on\ line\ %l - lexpr l:php_list[0] - call s:AddSigns(l:bufNo) - lope - return 1 - else - if 1 == g:phpqa_verbose - echohl Error | echo "No syntax errors" | echohl None + if &filetype == "php" + if 0 != len(g:phpqa_php_cmd) + let l:bufNo = bufnr('%') + call s:RemoveSigns() + let l:php_output=system(g:phpqa_php_cmd." -l ".@%." 1>/dev/null") + let l:php_list=split(l:php_output, "\n") + if 0 != len(l:php_list) + let l:php_list[0] = "P ".l:php_list[0] + set errorformat=%t\ %m\ in\ %f\ on\ line\ %l + lexpr l:php_list[0] + call s:AddSigns(l:bufNo) + lope + return 1 + else + if 1 == g:phpqa_verbose + echohl Error | echo "No syntax errors" | echohl None + endif + lgete [] + lcl endif - lgete [] - lcl + elseif 1 == g:phpqa_verbose + echohl Error | echo "PHP binary set to empty, not running lint" | echohl None endif - elseif 1 == g:phpqa_verbose - echohl Error | echo "PHP binary set to empty, not running lint" | echohl None endif return 0 endfunction @@ -177,7 +179,9 @@ function! phpqa#PhpQaTools(runcs,runmd) set errorformat=%t\ %f:%l:%c:\ %m,%t\ %f:%l\ %m lgete error_list call s:AddSigns(l:bufNo) - lope + if g:phpqa_open_loc + lope + endif else lgete [] lcl diff --git a/plugin/phpqa.vim b/plugin/phpqa.vim index 025d68c..dcf242a 100644 --- a/plugin/phpqa.vim +++ b/plugin/phpqa.vim @@ -66,6 +66,12 @@ if !exists("g:phpqa_codecoverage_autorun") let g:phpqa_codecoverage_autorun = 0 endif +" Whether to show signs for covered code (or only not covered) +" It may speed things up to turn this off +if !exists("g:phpqa_codecoverage_showcovered") + let g:phpqa_codecoverage_showcovered = 1 +endif + " Whether to automatically run codesniffer when saving a file if !exists("g:phpqa_codesniffer_autorun") let g:phpqa_codesniffer_autorun = 1 @@ -81,6 +87,12 @@ if !exists("g:phpqa_run_on_write") let g:phpqa_run_on_write = 1 endif +" Whether to open the location list automatically with CodeSniffer/Mess +" detector violations +if !exists("g:phpqa_open_loc") + let g:phpqa_open_loc = 1 +endif + " Run all QA tools function! phpqa:RunAll() @@ -108,8 +120,9 @@ endif nnoremap