diff options
author | Filippo Tessarotto <zoeslam@gmail.com> | 2021-07-04 14:16:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-04 21:16:55 +0900 |
commit | 12d8803015d5850d0e4f8fd0a713262b86a195d7 (patch) | |
tree | b513783981d110a9bab228bddd6b5f96f8fa0952 | |
parent | 52563f91816f86fbc3e6d9f01ca50a8d85fdbee5 (diff) | |
download | ale-12d8803015d5850d0e4f8fd0a713262b86a195d7.zip |
[PHP] PhpStan also looks for .dist config file (#3765)
* [PHP] PhpStan also looks for .dist config file
* Add tests
-rw-r--r-- | ale_linters/php/phpstan.vim | 3 | ||||
-rw-r--r-- | test/linter/test_phpstan.vader | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ale_linters/php/phpstan.vim b/ale_linters/php/phpstan.vim index 78f7dd10..5e231a3b 100644 --- a/ale_linters/php/phpstan.vim +++ b/ale_linters/php/phpstan.vim @@ -20,8 +20,9 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:level = ale#Var(a:buffer, 'php_phpstan_level') let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon') + let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist') - if empty(l:level) && empty(l:config_file_exists) + if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists) " if no configuration file is found, then use 4 as a default level let l:level = '4' endif diff --git a/test/linter/test_phpstan.vader b/test/linter/test_phpstan.vader index 813fe448..9f73c18a 100644 --- a/test/linter/test_phpstan.vader +++ b/test/linter/test_phpstan.vader @@ -58,6 +58,16 @@ Execute(Configuration file exists in current directory): \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw %s' \ ] +Execute(Configuration dist file exists in current directory): + call writefile(['parameters:', ' level: 7'], './phpstan.neon.dist') + let g:ale_php_phpstan_level = '' + let g:ale_php_phpstan_configuration = '' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw %s' + \ ] + Execute(Configuration file exists in current directory, but force phpstan level): call writefile(['parameters:', ' level: 7'], './phpstan.neon') let g:ale_php_phpstan_configuration = '' |