summaryrefslogtreecommitdiff
path: root/ale_linters/vim/vint.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-15 13:35:54 +0100
committerw0rp <devw0rp@gmail.com>2017-04-15 13:36:16 +0100
commit706dd050f2ec570eb12398d42a18f6c4f2bd56df (patch)
tree2c463aa0d5ef02feab3f2ef87215bd4417b47729 /ale_linters/vim/vint.vim
parent2f009690c3cf442f828830cc1d2fece619f308ff (diff)
downloadale-706dd050f2ec570eb12398d42a18f6c4f2bd56df.zip
Fix #257 in preparation for #427, standardise options with fallbacks, and make it so every value can be computed dynamically
Diffstat (limited to 'ale_linters/vim/vint.vim')
-rw-r--r--ale_linters/vim/vint.vim19
1 files changed, 12 insertions, 7 deletions
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim
index 821a0bdc..05ec2424 100644
--- a/ale_linters/vim/vint.vim
+++ b/ale_linters/vim/vint.vim
@@ -5,20 +5,25 @@
let g:ale_vim_vint_show_style_issues =
\ get(g:, 'ale_vim_vint_show_style_issues', 1)
-let s:warning_flag = g:ale_vim_vint_show_style_issues ? '-s' : '-w'
let s:vint_version = ale#semver#Parse(system('vint --version'))
let s:has_no_color_support = ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7])
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#GetCommand(buffer) abort
+ let l:warning_flag = g:ale_vim_vint_show_style_issues ? '-s' : '-w'
+
+ return 'vint '
+ \ . l:warning_flag . ' '
+ \ . (s:has_no_color_support ? '--no-color ' : '')
+ \ . s:enable_neovim
+ \ . s:format
+ \ . ' %t'
+endfunction
+
call ale#linter#Define('vim', {
\ 'name': 'vint',
\ 'executable': 'vint',
-\ 'command': 'vint '
-\ . s:warning_flag . ' '
-\ . (s:has_no_color_support ? '--no-color ' : '')
-\ . s:enable_neovim
-\ . s:format
-\ . ' %t',
+\ 'command_callback': 'ale_linters#vim#vint#GetCommand',
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\})