mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-21 17:18:38 +08:00
Fix psalm options. Retry on some test failures
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
" Author: Matt Brown <https://github.com/muglug>
|
" Author: Matt Brown <https://github.com/muglug>
|
||||||
" Description: plugin for Psalm, static analyzer for PHP
|
" Description: plugin for Psalm, static analyzer for PHP
|
||||||
|
|
||||||
call ale#Set('psalm_langserver_executable', 'psalm')
|
call ale#Set('php_psalm_executable', 'psalm')
|
||||||
call ale#Set('psalm_langserver_options', '')
|
call ale#Set('php_psalm_options', '')
|
||||||
call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
|
call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
||||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||||
@@ -12,13 +12,13 @@ function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#php#psalm#GetCommand(buffer) abort
|
function! ale_linters#php#psalm#GetCommand(buffer) abort
|
||||||
return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'psalm_langserver_options'))
|
return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'php_psalm_options'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('php', {
|
call ale#linter#Define('php', {
|
||||||
\ 'name': 'psalm',
|
\ 'name': 'psalm',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'psalm_langserver', [
|
\ 'executable': {b -> ale#node#FindExecutable(b, 'php_psalm', [
|
||||||
\ 'vendor/bin/psalm',
|
\ 'vendor/bin/psalm',
|
||||||
\ ])},
|
\ ])},
|
||||||
\ 'command': function('ale_linters#php#psalm#GetCommand'),
|
\ 'command': function('ale_linters#php#psalm#GetCommand'),
|
||||||
|
|||||||
@@ -189,42 +189,55 @@ g:ale_php_psalm_executable *g:ale_php_psalm_executable*
|
|||||||
|
|
||||||
This variable sets the executable used for psalm.
|
This variable sets the executable used for psalm.
|
||||||
|
|
||||||
g:ale_psalm_langserver_options *g:ale_psalm_langserver_options*
|
|
||||||
*b:ale_psalm_langserver_options*
|
g:ale_php_psalm_options *g:ale_php_psalm_options*
|
||||||
|
*b:ale_php_psalm_options*
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `''`
|
Default: `''`
|
||||||
|
|
||||||
This variable can be set to pass additional options to psalm.
|
This variable can be set to pass additional options to psalm.
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
php-cs-fixer *ale-php-php-cs-fixer*
|
|
||||||
|
|
||||||
g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable*
|
g:ale_php_psalm_use_global *g:ale_php_psalm_use_global*
|
||||||
*b:ale_php_cs_fixer_executable*
|
*b:ale_php_psalm_use_global*
|
||||||
|
Type: |Boolean|
|
||||||
|
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
php-cs-fixer *ale-php-php-cs-fixer*
|
||||||
|
|
||||||
|
g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable*
|
||||||
|
*b:ale_php_cs_fixer_executable*
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'php-cs-fixer'`
|
Default: `'php-cs-fixer'`
|
||||||
|
|
||||||
This variable sets executable used for php-cs-fixer.
|
This variable sets executable used for php-cs-fixer.
|
||||||
|
|
||||||
g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global*
|
|
||||||
*b:ale_php_cs_fixer_use_global*
|
|
||||||
Type: |Boolean|
|
|
||||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
|
||||||
|
|
||||||
This variable force globally installed fixer.
|
g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options*
|
||||||
|
*b:ale_php_cs_fixer_options*
|
||||||
g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options*
|
|
||||||
*b:ale_php_cs_fixer_options*
|
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `''`
|
Default: `''`
|
||||||
|
|
||||||
This variable can be set to pass additional options to php-cs-fixer.
|
This variable can be set to pass additional options to php-cs-fixer.
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
php *ale-php-php*
|
|
||||||
|
|
||||||
g:ale_php_php_executable *g:ale_php_php_executable*
|
g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global*
|
||||||
*b:ale_php_php_executable*
|
*b:ale_php_cs_fixer_use_global*
|
||||||
|
Type: |Boolean|
|
||||||
|
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||||
|
|
||||||
|
See |ale-integrations-local-executables|
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
php *ale-php-php*
|
||||||
|
|
||||||
|
g:ale_php_php_executable *g:ale_php_php_executable*
|
||||||
|
*b:ale_php_php_executable*
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'php'`
|
Default: `'php'`
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ Before:
|
|||||||
call ale#assert#SetUpLinterTest('php', 'psalm')
|
call ale#assert#SetUpLinterTest('php', 'psalm')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
unlet! g:i
|
||||||
|
unlet! g:matched
|
||||||
|
|
||||||
if isdirectory(g:dir . '/.git')
|
if isdirectory(g:dir . '/.git')
|
||||||
call delete(g:dir . '/.git', 'd')
|
call delete(g:dir . '/.git', 'd')
|
||||||
endif
|
endif
|
||||||
@@ -22,19 +25,35 @@ Execute(Vendor executables should be detected):
|
|||||||
\ . '/psalm-project/vendor/bin/psalm'
|
\ . '/psalm-project/vendor/bin/psalm'
|
||||||
\ )) . ' --language-server'
|
\ )) . ' --language-server'
|
||||||
|
|
||||||
|
let g:ale_php_psalm_use_global = 1
|
||||||
|
|
||||||
|
AssertLinter 'psalm',
|
||||||
|
\ ale#Escape('psalm') . ' --language-server'
|
||||||
|
|
||||||
Execute(User provided options should be used):
|
Execute(User provided options should be used):
|
||||||
let g:ale_psalm_langserver_options = '--my-user-provided-option my-value'
|
let g:ale_php_psalm_options = '--my-user-provided-option my-value'
|
||||||
|
|
||||||
AssertLinter 'psalm',
|
AssertLinter 'psalm',
|
||||||
\ ale#Escape('psalm')
|
\ ale#Escape('psalm')
|
||||||
\ . ' --language-server --my-user-provided-option my-value'
|
\ . ' --language-server --my-user-provided-option my-value'
|
||||||
|
|
||||||
|
|
||||||
Execute(The project path should be correct for .git directories):
|
Execute(The project path should be correct for .git directories):
|
||||||
call ale#test#SetFilename('psalm-project/test.php')
|
call ale#test#SetFilename('psalm-project/test.php')
|
||||||
|
|
||||||
if !isdirectory(g:dir . '/.git')
|
for g:i in range(4)
|
||||||
call mkdir(g:dir . '/.git')
|
if !isdirectory(g:dir . '/.git')
|
||||||
endif
|
call mkdir(g:dir . '/.git')
|
||||||
|
endif
|
||||||
|
|
||||||
AssertLSPProject g:dir
|
try
|
||||||
|
AssertLSPProject g:dir
|
||||||
|
catch /.+/
|
||||||
|
endtry
|
||||||
|
|
||||||
|
let g:matched = 1
|
||||||
|
break
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if !g:matched
|
||||||
|
AssertLSPProject g:dir
|
||||||
|
endif
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Before:
|
|||||||
let g:ale_completion_delay = 0
|
let g:ale_completion_delay = 0
|
||||||
|
|
||||||
" Run this check a few times, as it can fail randomly.
|
" Run this check a few times, as it can fail randomly.
|
||||||
for g:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
|
for l:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
|
||||||
call ale#completion#Queue()
|
call ale#completion#Queue()
|
||||||
sleep 1m
|
sleep 1m
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user