Added phpcs options support as described in #257

This commit is contained in:
matthias 2018-08-16 16:44:41 +02:00
parent ad8b260519
commit 02fdfcda58
2 changed files with 12 additions and 1 deletions

View File

@ -3,6 +3,7 @@
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '') let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
call ale#Set('php_phpcs_options', '')
call ale#Set('php_phpcs_executable', 'phpcs') call ale#Set('php_phpcs_executable', 'phpcs')
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
@ -11,8 +12,11 @@ function! ale_linters#php#phpcs#GetCommand(buffer) abort
let l:standard_option = !empty(l:standard) let l:standard_option = !empty(l:standard)
\ ? '--standard=' . l:standard \ ? '--standard=' . l:standard
\ : '' \ : ''
let l:options = ale#Var(a:buffer, 'php_phpcs_options')
return '%e -s --report=emacs --stdin-path=%s' . ale#Pad(l:standard_option) return '%e -s --report=emacs --stdin-path=%s'
\ . ale#Pad(l:standard_option)
\ . ' ' . l:options
endfunction endfunction
function! ale_linters#php#phpcs#Handle(buffer, lines) abort function! ale_linters#php#phpcs#Handle(buffer, lines) abort

View File

@ -114,6 +114,13 @@ g:ale_php_phpcs_use_global *g:ale_php_phpcs_use_global*
See |ale-integrations-local-executables| See |ale-integrations-local-executables|
g:ale_php_phpcs_options *g:ale_php_phpcs_options*
*b:ale_php_phpcs_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to php-cs
=============================================================================== ===============================================================================
phpmd *ale-php-phpmd* phpmd *ale-php-phpmd*