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: nametake https://nametake.github.io
2 " Description: apiblueprint parser
4 function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort
5 " Matches patterns line the following:
7 " warning: (3) unable to parse response signature, expected 'response [<HTTP status code>] [(<media type>)]'; line 4, column 3k - line 4, column 22
8 " warning: (10) message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs; line 30, column 5 - line 30, column 9; line 31, column 9 - line 31, column 14; line 32, column 9 - line 32, column 14
9 let l:pattern = '\(^.*\): (\d\+) \(.\{-\}\); line \(\d\+\), column \(\d\+\) - line \d\+, column \d\+\(.*; line \d\+, column \d\+ - line \(\d\+\), column \(\d\+\)\)\{-\}$'
12 for l:match in ale#util#GetMatches(a:lines[2:], l:pattern)
14 \ 'type': l:match[1] is# 'warning' ? 'W' : 'E',
16 \ 'lnum': l:match[3] + 0,
17 \ 'col': l:match[4] + 0,
20 if l:match[5] isnot# ''
21 let l:item.end_lnum = l:match[6] + 0
22 let l:item.end_col = l:match[7] + 0
25 call add(l:output, l:item)
32 call ale#linter#Define('apiblueprint', {
34 \ 'output_stream': 'stderr',
35 \ 'executable': 'drafter',
36 \ 'command': 'drafter --use-line-num --validate',
37 \ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',