diff options
author | w0rp <devw0rp@gmail.com> | 2019-05-07 19:38:32 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-05-07 19:38:38 +0100 |
commit | 5f64f8dc5799d9ad93544d24fb780428cd07dbbe (patch) | |
tree | 2039386cfbaa537d8d7ac9664f6f3efdf0248ac4 | |
parent | c10da0e390b37ae6a739769dffb3b8dcf36a81d0 (diff) | |
download | ale-5f64f8dc5799d9ad93544d24fb780428cd07dbbe.zip |
Escape phpstan arguments, and update documentation
-rw-r--r-- | ale_linters/php/phpstan.vim | 4 | ||||
-rw-r--r-- | doc/ale-php.txt | 8 | ||||
-rw-r--r-- | test/command_callback/test_phpstan_command_callbacks.vader | 12 |
3 files changed, 13 insertions, 11 deletions
diff --git a/ale_linters/php/phpstan.vim b/ale_linters/php/phpstan.vim index ca12211c..b621f855 100644 --- a/ale_linters/php/phpstan.vim +++ b/ale_linters/php/phpstan.vim @@ -9,7 +9,7 @@ let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', ' function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') let l:configuration_option = !empty(l:configuration) - \ ? ' -c ' . l:configuration + \ ? ' -c ' . ale#Escape(l:configuration) \ : '' let l:level = ale#Var(a:buffer, 'php_phpstan_level') @@ -21,7 +21,7 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort endif let l:level_option = !empty(l:level) - \ ? ' -l ' . l:level + \ ? ' -l ' . ale#Escape(l:level) \ : '' let l:error_format = ale#semver#GTE(a:version, [0, 10, 3]) diff --git a/doc/ale-php.txt b/doc/ale-php.txt index 83bc0fd5..6f53cead 100644 --- a/doc/ale-php.txt +++ b/doc/ale-php.txt @@ -154,11 +154,13 @@ g:ale_php_phpstan_executable *g:ale_php_phpstan_executable* g:ale_php_phpstan_level *g:ale_php_phpstan_level* *b:ale_php_phpstan_level* - Type: |Number| - Default: `4` + Type: |String| + Default: `''` This variable controls the rule levels. 0 is the loosest and 4 is the - strictest. + strictest. If this option isn't set, the rule level will be controlled by + the configuration file. If no configuration file can be detected, `'4'` will + be used instead. g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* diff --git a/test/command_callback/test_phpstan_command_callbacks.vader b/test/command_callback/test_phpstan_command_callbacks.vader index 72524c55..3714fc64 100644 --- a/test/command_callback/test_phpstan_command_callbacks.vader +++ b/test/command_callback/test_phpstan_command_callbacks.vader @@ -12,27 +12,27 @@ Execute(Custom executables should be used for the executable and command): let g:ale_php_phpstan_executable = 'phpstan_test' AssertLinter 'phpstan_test', - \ ale#Escape('phpstan_test') . ' analyze --no-progress --errorFormat raw -l 4 %s' + \ ale#Escape('phpstan_test') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('4') . ' %s' Execute(project with level set to 3): call ale#test#SetFilename('phpstan-test-files/foo/test.php') let g:ale_php_phpstan_level = 3 AssertLinter 'phpstan', - \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l 3 %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('3') . ' %s' Execute(Custom phpstan configuration file): let g:ale_php_phpstan_configuration = 'phpstan_config' AssertLinter 'phpstan', - \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c phpstan_config -l 4 %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan_config') . ' -l ' . ale#Escape('4') . ' %s' Execute(Choose the right format for error format param): GivenCommandOutput ['0.10.3'] AssertLinter 'phpstan', [ \ ale#Escape('phpstan') . ' --version', - \ ale#Escape('phpstan') . ' analyze --no-progress --error-format raw -l 4 %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --error-format raw -l ' . ale#Escape('4') . ' %s' \ ] Execute(Configuration file exists in current directory): @@ -52,7 +52,7 @@ Execute(Configuration file exists in current directory, but force phpstan level) AssertLinter 'phpstan', [ \ ale#Escape('phpstan') . ' --version', - \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l 7 %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -l ' . ale#Escape('7') . ' %s' \ ] Execute(Configuration file exists in current directory, but force phpstan configuration): @@ -62,5 +62,5 @@ Execute(Configuration file exists in current directory, but force phpstan config AssertLinter 'phpstan', [ \ ale#Escape('phpstan') . ' --version', - \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c phpstan.custom.neon %s' + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat raw -c ' . ale#Escape('phpstan.custom.neon') . ' %s' \ ] |