]> git.madduck.net Git - etc/vim.git/blob - ale_linters/tcl/nagelfar.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / ale_linters / tcl / nagelfar.vim
1 " Author: Nick James <github@nsjuk.xyz>
2 " Description: nagelfar linter for tcl files
3
4 call ale#Set('tcl_nagelfar_executable', 'nagelfar.tcl')
5 call ale#Set('tcl_nagelfar_options', '')
6
7 function! ale_linters#tcl#nagelfar#GetCommand(buffer) abort
8     let l:options = ale#Var(a:buffer, 'tcl_nagelfar_options')
9
10     return '%e' . ale#Pad(l:options) . ' %s'
11 endfunction
12
13 function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort
14     " Matches patterns like the following:
15     " Line   5: W Found constant "bepa" which is also a variable.
16     " Line  13: E Wrong number of arguments (3) to "set"
17     " Line  93: N Close brace not aligned with line 90 (4 0)
18     let l:pattern = '^Line\s\+\([0-9]\+\): \([NEW]\) \(.*\)$'
19     let l:output = []
20
21     for l:match in ale#util#GetMatches(a:lines, l:pattern)
22         call add(l:output, {
23         \   'lnum': l:match[1] + 0,
24         \   'type': l:match[2] is# 'N' ? 'W' : l:match[2],
25         \   'text': l:match[3],
26         \})
27     endfor
28
29     return l:output
30 endfunction
31
32 call ale#linter#Define('tcl', {
33 \   'name': 'nagelfar',
34 \   'output_stream': 'stdout',
35 \   'executable': {b -> ale#Var(b, 'tcl_nagelfar_executable')},
36 \   'command': function('ale_linters#tcl#nagelfar#GetCommand'),
37 \   'callback': 'ale_linters#tcl#nagelfar#Handle',
38 \   'lint_file': 1,
39 \})