]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/robot/rflint.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:

Merge commit 'd49e95aa7ba744f0a7f544aca43afdb6aab41f24' as '.vim/bundle/asyncomplete...
[etc/vim.git] / .vim / bundle / ale / ale_linters / robot / rflint.vim
1 " Author: Samuel Branisa <branisa.samuel@icloud.com>
2 " Description: rflint linting for robot framework files
3
4 call ale#Set('robot_rflint_executable', 'rflint')
5
6 function! ale_linters#robot#rflint#GetExecutable(buffer) abort
7     return ale#Var(a:buffer, 'robot_rflint_executable')
8 endfunction
9
10 function! ale_linters#robot#rflint#GetCommand(buffer) abort
11     let l:executable = ale_linters#robot#rflint#GetExecutable(a:buffer)
12     let l:flags = '--format'
13     \ . ' "{filename}:{severity}:{linenumber}:{char}:{rulename}:{message}"'
14
15     return l:executable
16     \   . ' '
17     \   . l:flags
18     \   . ' %s'
19 endfunction
20
21 function! ale_linters#robot#rflint#Handle(buffer, lines) abort
22     let l:pattern = '\v^([[:alnum:][:punct:]]+):(W|E):([[:digit:]]+):([[:digit:]]+):([[:alnum:]]+):(.*)$'
23     let l:output = []
24
25     for l:match in ale#util#GetMatches(a:lines, l:pattern)
26         call add(l:output, {
27         \   'bufnr': a:buffer,
28         \   'filename': l:match[1],
29         \   'type': l:match[2],
30         \   'lnum': str2nr(l:match[3]),
31         \   'col': str2nr(l:match[4]),
32         \   'text': l:match[5],
33         \   'detail': l:match[6],
34         \})
35     endfor
36
37     return l:output
38 endfunction
39
40 call ale#linter#Define('robot', {
41 \   'name': 'rflint',
42 \   'executable': function('ale_linters#robot#rflint#GetExecutable'),
43 \   'command': function('ale_linters#robot#rflint#GetCommand'),
44 \   'callback': 'ale_linters#robot#rflint#Handle',
45 \})
46