Set the --no-color flag for Vint if we fail to parse the version number for some reason

This commit is contained in:
w0rp 2017-06-22 12:24:25 +01:00
parent 93539e10de
commit 40f6ee4c39

View file

@ -6,9 +6,10 @@ let g:ale_vim_vint_show_style_issues =
\ get(g:, 'ale_vim_vint_show_style_issues', 1) \ get(g:, 'ale_vim_vint_show_style_issues', 1)
let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : '' let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : ''
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
let s:vint_version = []
function! ale_linters#vim#vint#VersionCommand(buffer) abort function! ale_linters#vim#vint#VersionCommand(buffer) abort
if !exists('s:vint_version') if empty(s:vint_version)
" Check the Vint version if we haven't checked it already. " Check the Vint version if we haven't checked it already.
return 'vint --version' return 'vint --version'
endif endif
@ -17,13 +18,13 @@ function! ale_linters#vim#vint#VersionCommand(buffer) abort
endfunction endfunction
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
if !empty(a:version_output) if empty(s:vint_version) && !empty(a:version_output)
" Parse the version out of the --version output. " Parse the version out of the --version output.
let s:vint_version = ale#semver#Parse(join(a:version_output, "\n")) let s:vint_version = ale#semver#Parse(join(a:version_output, "\n"))
endif endif
let l:can_use_no_color_flag = exists('s:vint_version') let l:can_use_no_color_flag = empty(s:vint_version)
\ && ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7]) \ || ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7])
let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'