All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: w0rp <devw0rp@gmail.com>, KabbAmine <amine.kabb@gmail.com>
2 " Description: This file adds support for checking Vim code with Vint.
4 " This flag can be used to change enable/disable style issues.
5 call ale#Set('vim_vint_show_style_issues', 1)
6 call ale#Set('vim_vint_executable', 'vint')
7 let s:enable_neovim = has('nvim') ? ' --enable-neovim' : ''
8 let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"'
10 function! ale_linters#vim#vint#GetCommand(buffer, version) abort
11 let l:can_use_no_color_flag = empty(a:version)
12 \ || ale#semver#GTE(a:version, [0, 3, 7])
14 let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
16 " Use the --stdin-display-name argument if supported, temp file otherwise.
17 let l:stdin_or_temp = ale#semver#GTE(a:version, [0, 4, 0])
18 \ ? ' --stdin-display-name %s -'
22 \ . ' ' . l:warning_flag
23 \ . (l:can_use_no_color_flag ? ' --no-color' : '')
29 let s:word_regex_list = [
30 \ '\v^Undefined variable: ([^ ]+)',
31 \ '\v^Make the scope explicit like ...([^ ]+). ',
32 \ '\v^.*start with a capital or contain a colon: ([^ ]+)',
33 \ '\v.*instead of .(\=[=~]).',
36 function! ale_linters#vim#vint#Handle(buffer, lines) abort
37 let l:loclist = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines)
39 for l:item in l:loclist
42 for l:regex in s:word_regex_list
43 let l:match = matchlist(l:item.text, l:regex)
46 let l:item.end_col = l:item.col + len(l:match[1]) - 1
55 call ale#linter#Define('vim', {
57 \ 'executable': {buffer -> ale#Var(buffer, 'vim_vint_executable')},
58 \ 'command': {buffer -> ale#semver#RunWithVersionCheck(
60 \ ale#Var(buffer, 'vim_vint_executable'),
62 \ function('ale_linters#vim#vint#GetCommand'),
64 \ 'callback': 'ale_linters#vim#vint#Handle',