summaryrefslogtreecommitdiff
path: root/ale_linters/vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-09 23:42:54 +0000
committerw0rp <devw0rp@gmail.com>2017-11-09 23:42:54 +0000
commitd425b8a18ab3c8155fdc7376192434f8878e954f (patch)
tree8a702b7b398fe43e9b8b3a05e3011b3ca530fd83 /ale_linters/vim
parentc1fa88e78ccfeb98a688a209cd9f67da1bf076aa (diff)
downloadale-d425b8a18ab3c8155fdc7376192434f8878e954f.zip
Simplfy semver handling and share the semver version cache across everything
Diffstat (limited to 'ale_linters/vim')
-rw-r--r--ale_linters/vim/vint.vim20
1 files changed, 7 insertions, 13 deletions
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim
index adf2b4ab..dfa00dc0 100644
--- a/ale_linters/vim/vint.vim
+++ b/ale_linters/vim/vint.vim
@@ -6,25 +6,19 @@ 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 ' : ''
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
- if empty(s:vint_version)
- " Check the Vint version if we haven't checked it already.
- return 'vint --version'
- endif
-
- return ''
+ " Check the Vint version if we haven't checked it already.
+ return !ale#semver#HasVersion('vint')
+ \ ? 'vint --version'
+ \ : ''
endfunction
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
- if empty(s:vint_version) && !empty(a:version_output)
- " Parse the version out of the --version output.
- let s:vint_version = ale#semver#Parse(join(a:version_output, "\n"))
- endif
+ let l:version = ale#semver#GetVersion('vint', a:version_output)
- let l:can_use_no_color_flag = empty(s:vint_version)
- \ || ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7])
+ 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'