mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 21:24:33 +08:00
Merge pull request #2491 from mpesari/phpstan-autoload-option
Add phpstan autoload option
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan')
|
let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan')
|
||||||
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '')
|
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '')
|
||||||
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
|
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
|
||||||
|
let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '')
|
||||||
|
|
||||||
function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
||||||
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
|
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
|
||||||
@@ -12,6 +13,11 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
|||||||
\ ? ' -c ' . ale#Escape(l:configuration)
|
\ ? ' -c ' . ale#Escape(l:configuration)
|
||||||
\ : ''
|
\ : ''
|
||||||
|
|
||||||
|
let l:autoload = ale#Var(a:buffer, 'php_phpstan_autoload')
|
||||||
|
let l:autoload_option = !empty(l:autoload)
|
||||||
|
\ ? ' -a ' . ale#Escape(l:autoload)
|
||||||
|
\ : ''
|
||||||
|
|
||||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||||
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
||||||
|
|
||||||
@@ -31,6 +37,7 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
|||||||
return '%e analyze --no-progress'
|
return '%e analyze --no-progress'
|
||||||
\ . l:error_format
|
\ . l:error_format
|
||||||
\ . l:configuration_option
|
\ . l:configuration_option
|
||||||
|
\ . l:autoload_option
|
||||||
\ . l:level_option
|
\ . l:level_option
|
||||||
\ . ' %s'
|
\ . ' %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -171,6 +171,14 @@ g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration*
|
|||||||
This variable sets path to phpstan configuration file.
|
This variable sets path to phpstan configuration file.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_php_phpstan_autoload *g:ale_php_phpstan_autoload*
|
||||||
|
*b:ale_php_phpstan_autoload*
|
||||||
|
Type: |String|
|
||||||
|
Default: `''`
|
||||||
|
|
||||||
|
This variable sets path to phpstan autoload file.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
psalm *ale-php-psalm*
|
psalm *ale-php-psalm*
|
||||||
|
|
||||||
|
|||||||
@@ -64,3 +64,9 @@ Execute(Configuration file exists in current directory, but force phpstan config
|
|||||||
\ ale#Escape('phpstan') . ' --version',
|
\ ale#Escape('phpstan') . ' --version',
|
||||||
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan.custom.neon') . ' %s'
|
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan.custom.neon') . ' %s'
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
|
Execute(Autoload parameter is added to the command):
|
||||||
|
let g:ale_php_phpstan_autoload = 'autoload.php'
|
||||||
|
|
||||||
|
AssertLinter 'phpstan',
|
||||||
|
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -a ' . ale#Escape('autoload.php') . ' -l ' . ale#Escape('4') . ' %s'
|
||||||
|
|||||||
Reference in New Issue
Block a user