1
0
Fork 0
mirror of synced 2024-11-16 14:05:34 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/go/staticcheck.vim

35 lines
1.1 KiB
VimL
Raw Normal View History

" Author: Ben Reedy <https://github.com/breed808>
" Description: staticcheck for Go files
2021-05-31 16:30:26 -04:00
call ale#Set('go_staticcheck_executable', 'staticcheck')
call ale#Set('go_staticcheck_options', '')
2021-07-04 16:47:44 -04:00
call ale#Set('go_staticcheck_lint_package', 1)
2021-05-31 16:30:26 -04:00
call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
2019-08-22 11:36:17 -04:00
let l:env = ale#go#EnvString(a:buffer)
if l:lint_package
2021-05-31 16:30:26 -04:00
return l:env . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
endif
2021-05-31 16:30:26 -04:00
return l:env . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '')
2021-05-05 04:25:00 -04:00
\ . ' %s:t'
endfunction
call ale#linter#Define('go', {
\ 'name': 'staticcheck',
2021-05-31 16:30:26 -04:00
\ 'executable': {b -> ale#path#FindExecutable(b, 'go_staticcheck', [
\ ale#go#GetGoPathExecutable('bin/staticcheck'),
\ ])},
2021-05-05 04:25:00 -04:00
\ 'cwd': '%s:h',
2019-03-08 06:04:56 -05:00
\ 'command': function('ale_linters#go#staticcheck#GetCommand'),
\ 'callback': 'ale#handlers#go#Handler',
\ 'output_stream': 'both',
\ 'lint_file': 1,
\})