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: hsanson <hsanson@gmail.com>
2 " Description: Lints sh files using bashate
3 " URL: https://github.com/openstack/bashate
5 call ale#Set('sh_bashate_executable', 'bashate')
6 call ale#Set('sh_bashate_options', '')
8 function! ale_linters#sh#bashate#GetExecutable(buffer) abort
9 return ale#Var(a:buffer, 'sh_bashate_executable')
12 function! ale_linters#sh#bashate#GetCommand(buffer) abort
13 let l:options = ale#Var(a:buffer, 'sh_bashate_options')
14 let l:executable = ale_linters#sh#bashate#GetExecutable(a:buffer)
16 return ale#Escape(l:executable) . ' ' . l:options . ' ' . '%t'
19 function! ale_linters#sh#bashate#Handle(buffer, lines) abort
20 " Matches patterns line the following:
22 " /path/to/script/file:694:1: E003 Indent not multiple of 4
23 let l:pattern = ':\(\d\+\):\(\d\+\): \(.*\)$'
26 for l:match in ale#util#GetMatches(a:lines, l:pattern)
28 \ 'lnum': str2nr(l:match[1]),
29 \ 'col': str2nr(l:match[2]),
37 call ale#linter#Define('sh', {
39 \ 'output_stream': 'stdout',
40 \ 'executable': function('ale_linters#sh#bashate#GetExecutable'),
41 \ 'command': function('ale_linters#sh#bashate#GetCommand'),
42 \ 'callback': 'ale_linters#sh#bashate#Handle',