1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +08:00

plugins update

This commit is contained in:
Geezus
2019-05-16 14:48:47 -05:00
parent 5bc3d0226c
commit 555992dd9b
162 changed files with 3534 additions and 1379 deletions

View File

@ -36,6 +36,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
\ 'col': l:match[2] + 0,
\ 'text': l:text,
\ 'type': l:type is# 'error' ? 'E' : 'W',
\ 'sub_type': 'style',
\})
endfor

View File

@ -3,44 +3,42 @@
" Set to change the ruleset
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', '4')
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_autoload = get(g:, 'ale_php_phpstan_autoload', '')
function! ale_linters#php#phpstan#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'php_phpstan_executable')
endfunction
function! ale_linters#php#phpstan#VersionCheck(buffer) abort
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
" If we have previously stored the version number in a cache, then
" don't look it up again.
if ale#semver#HasVersion(l:executable)
" Returning an empty string skips this command.
return ''
endif
let l:executable = ale#Escape(l:executable)
return l:executable . ' --version'
endfunction
function! ale_linters#php#phpstan#GetCommand(buffer, version_output) abort
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:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
let l:error_format = ale#semver#GTE(l:version, [0, 10, 3])
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:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
if empty(l:level) && empty(l:config_file_exists)
" if no configuration file is found, then use 4 as a default level
let l:level = '4'
endif
let l:level_option = !empty(l:level)
\ ? ' -l ' . ale#Escape(l:level)
\ : ''
let l:error_format = ale#semver#GTE(a:version, [0, 10, 3])
\ ? ' --error-format raw'
\ : ' --errorFormat raw'
return '%e analyze -l'
\ . ale#Var(a:buffer, 'php_phpstan_level')
return '%e analyze --no-progress'
\ . l:error_format
\ . l:configuration_option
\ . l:autoload_option
\ . l:level_option
\ . ' %s'
endfunction
@ -56,7 +54,7 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort
call add(l:output, {
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[3],
\ 'type': 'W',
\ 'type': 'E',
\})
endfor
@ -65,10 +63,12 @@ endfunction
call ale#linter#Define('php', {
\ 'name': 'phpstan',
\ 'executable': function('ale_linters#php#phpstan#GetExecutable'),
\ 'command_chain': [
\ {'callback': 'ale_linters#php#phpstan#VersionCheck'},
\ {'callback': 'ale_linters#php#phpstan#GetCommand'},
\ ],
\ 'executable': {b -> ale#Var(b, 'php_phpstan_executable')},
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale#Var(buffer, 'php_phpstan_executable'),
\ '%e --version',
\ function('ale_linters#php#phpstan#GetCommand'),
\ )},
\ 'callback': 'ale_linters#php#phpstan#Handle',
\})