diff options
author | w0rp <devw0rp@gmail.com> | 2018-04-08 18:10:00 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-04-08 18:10:00 +0100 |
commit | 1123669839c1656deb20f433fc672ca0abdda705 (patch) | |
tree | 462f84ae6933029e7c977c1e0e4fea94ed8585d2 /ale_linters/vim | |
parent | f9ae58849a8b465e367ed311f0506bae2a537a62 (diff) | |
download | ale-1123669839c1656deb20f433fc672ca0abdda705.zip |
Close #1315 - Make the vint executable configurable
Diffstat (limited to 'ale_linters/vim')
-rw-r--r-- | ale_linters/vim/vint.vim | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim index dfa00dc0..cf2d4afd 100644 --- a/ale_linters/vim/vint.vim +++ b/ale_linters/vim/vint.vim @@ -2,31 +2,38 @@ " Description: This file adds support for checking Vim code with Vint. " This flag can be used to change enable/disable style issues. -let g:ale_vim_vint_show_style_issues = -\ get(g:, 'ale_vim_vint_show_style_issues', 1) -let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : '' +call ale#Set('vim_vint_show_style_issues', 1) +call ale#Set('vim_vint_executable', 'vint') +let s:enable_neovim = has('nvim') ? ' --enable-neovim' : '' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' +function! ale_linters#vim#vint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'vim_vint_executable') +endfunction + function! ale_linters#vim#vint#VersionCommand(buffer) abort + let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) + " Check the Vint version if we haven't checked it already. - return !ale#semver#HasVersion('vint') - \ ? 'vint --version' + return !ale#semver#HasVersion(l:executable) + \ ? ale#Escape(l:executable) . ' --version' \ : '' endfunction function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort - let l:version = ale#semver#GetVersion('vint', a:version_output) + let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) + let l:version = ale#semver#GetVersion(l:executable, a:version_output) let l:can_use_no_color_flag = empty(l:version) \ || ale#semver#GTE(l:version, [0, 3, 7]) let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' - return 'vint ' - \ . l:warning_flag . ' ' - \ . (l:can_use_no_color_flag ? '--no-color ' : '') + return ale#Escape(l:executable) + \ . ' ' . l:warning_flag + \ . (l:can_use_no_color_flag ? ' --no-color' : '') \ . s:enable_neovim - \ . s:format + \ . ' ' . s:format \ . ' %t' endfunction @@ -58,7 +65,7 @@ endfunction call ale#linter#Define('vim', { \ 'name': 'vint', -\ 'executable': 'vint', +\ 'executable_callback': 'ale_linters#vim#vint#GetExecutable', \ 'command_chain': [ \ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, \ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, |