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: Nick Yamane <nick.diego@gmail.com>
2 " Description: gitlint for git commit message files
4 call ale#Set('gitcommit_gitlint_executable', 'gitlint')
5 call ale#Set('gitcommit_gitlint_options', '')
6 call ale#Set('gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0))
8 function! ale_linters#gitcommit#gitlint#GetExecutable(buffer) abort
9 return ale#python#FindExecutable(a:buffer, 'gitcommit_gitlint', ['gitlint'])
12 function! ale_linters#gitcommit#gitlint#GetCommand(buffer) abort
13 let l:options = ale#Var(a:buffer, 'gitcommit_gitlint_options')
15 return '%e' . ale#Pad(l:options) . ' lint'
18 function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
19 " Matches patterns line the following:
20 let l:pattern = '\v^(\d+): (\w+) (.*)$'
23 for l:match in ale#util#GetMatches(a:lines, l:pattern)
24 let l:code = l:match[2]
26 if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
27 if l:code is# 'T2' || l:code is# 'B2'
33 \ 'lnum': l:match[1] + 0,
39 call add(l:output, l:item)
45 call ale#linter#Define('gitcommit', {
47 \ 'output_stream': 'stderr',
48 \ 'executable': function('ale_linters#gitcommit#gitlint#GetExecutable'),
49 \ 'command': function('ale_linters#gitcommit#gitlint#GetCommand'),
50 \ 'callback': 'ale_linters#gitcommit#gitlint#Handle',