summaryrefslogtreecommitdiff
path: root/ale_linters/php/phpcs.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/php/phpcs.vim')
-rw-r--r--ale_linters/php/phpcs.vim17
1 files changed, 5 insertions, 12 deletions
diff --git a/ale_linters/php/phpcs.vim b/ale_linters/php/phpcs.vim
index faf8ad55..25e53714 100644
--- a/ale_linters/php/phpcs.vim
+++ b/ale_linters/php/phpcs.vim
@@ -6,23 +6,13 @@ let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
call ale#Set('php_phpcs_executable', 'phpcs')
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
-function! ale_linters#php#phpcs#GetExecutable(buffer) abort
- return ale#node#FindExecutable(a:buffer, 'php_phpcs', [
- \ 'vendor/bin/phpcs',
- \ 'phpcs'
- \])
-endfunction
-
function! ale_linters#php#phpcs#GetCommand(buffer) abort
- let l:executable = ale_linters#php#phpcs#GetExecutable(a:buffer)
-
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
let l:standard_option = !empty(l:standard)
\ ? '--standard=' . l:standard
\ : ''
- return ale#Escape(l:executable)
- \ . ' -s --report=emacs --stdin-path=%s ' . l:standard_option
+ return '%e -s --report=emacs --stdin-path=%s' . ale#Pad(l:standard_option)
endfunction
function! ale_linters#php#phpcs#Handle(buffer, lines) abort
@@ -50,7 +40,10 @@ endfunction
call ale#linter#Define('php', {
\ 'name': 'phpcs',
-\ 'executable_callback': 'ale_linters#php#phpcs#GetExecutable',
+\ 'executable_callback': ale#node#FindExecutableFunc('php_phpcs', [
+\ 'vendor/bin/phpcs',
+\ 'phpcs'
+\ ]),
\ 'command_callback': 'ale_linters#php#phpcs#GetCommand',
\ 'callback': 'ale_linters#php#phpcs#Handle',
\})