summaryrefslogtreecommitdiff
path: root/ale_linters/vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-26 17:23:20 +0100
committerw0rp <devw0rp@gmail.com>2017-08-26 17:23:20 +0100
commitb9cf450684fda2a10dcc65bb09ef11b10469363f (patch)
treeea3b0f5453ff2df2e404e946be898b0147726164 /ale_linters/vim
parente13651c16d4f80c9453d6790be78671d2f59a95f (diff)
downloadale-b9cf450684fda2a10dcc65bb09ef11b10469363f.zip
Set the end column for some Vint problems
Diffstat (limited to 'ale_linters/vim')
-rw-r--r--ale_linters/vim/vint.vim28
1 files changed, 27 insertions, 1 deletions
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim
index 18ae2e4c..adf2b4ab 100644
--- a/ale_linters/vim/vint.vim
+++ b/ale_linters/vim/vint.vim
@@ -36,6 +36,32 @@ function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
\ . ' %t'
endfunction
+let s:word_regex_list = [
+\ '\v^Undefined variable: ([^ ]+)',
+\ '\v^Make the scope explicit like ...([^ ]+). ',
+\ '\v^.*start with a capital or contain a colon: ([^ ]+)',
+\ '\v.*instead of .(\=[=~]).',
+\]
+
+function! ale_linters#vim#vint#Handle(buffer, lines) abort
+ let l:loclist = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines)
+
+ for l:item in l:loclist
+ let l:match = []
+
+ for l:regex in s:word_regex_list
+ let l:match = matchlist(l:item.text, l:regex)
+
+ if !empty(l:match)
+ let l:item.end_col = l:item.col + len(l:match[1]) - 1
+ break
+ endif
+ endfor
+ endfor
+
+ return l:loclist
+endfunction
+
call ale#linter#Define('vim', {
\ 'name': 'vint',
\ 'executable': 'vint',
@@ -43,5 +69,5 @@ call ale#linter#Define('vim', {
\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'},
\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'},
\ ],
-\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
+\ 'callback': 'ale_linters#vim#vint#Handle',
\})