diff options
author | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
commit | 217284360d35711b751859ed27a7a3c3da300e85 (patch) | |
tree | 4b26a84b397e3ac15a8b13a572b1f9a50312dbab /ale_linters/php/phpcs.vim | |
parent | 9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff) | |
download | ale-217284360d35711b751859ed27a7a3c3da300e85.zip |
Simplify the code for most linters and tests with closures
Diffstat (limited to 'ale_linters/php/phpcs.vim')
-rw-r--r-- | ale_linters/php/phpcs.vim | 17 |
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', \}) |