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 " Description: Hurl linter using hurlfmt --check.
4 call ale#Set('hurl_hurlfmt_executable', 'hurlfmt')
6 function! ale_linters#hurl#hurlfmt#GetCommand(buffer) abort
8 \ . ' --check --no-color '
11 function! ale_linters#hurl#hurlfmt#HandleOutput(buffer, lines) abort
14 " error: Parsing space
17 " 8 | header "Content-Type"= "application/json; charset=utf-8"
18 " | ^ expecting a space
24 " 11 | PUT https://jsonplaceholder.typicode.com/posts/{post_id}}
25 " | ^ illegal character <{>
28 " Note: hurlfmt seems to report always the first error only so we assume
29 " there is only one error to make parsing easier.
36 let l:pattern = '\v(error|warning): (.+) --\> (.+):(\d+):(\d+) .+ \^ (.+) |'
37 let l:lines = join(a:lines, ' ')
39 for l:match in ale#util#GetMatches(l:lines, l:pattern)
42 \ 'lnum': match[4] + 0,
43 \ 'col': match[5] + 0,
44 \ 'end_col': match[5] + 0,
45 \ 'text': match[2] . ' : ' . match[6],
46 \ 'type': (match[1] is# 'error') ? 'E' : 'W'
53 function! ale_linters#hurl#hurlfmt#GetType(severity) abort
54 if a:severity is? 'convention'
55 \|| a:severity is? 'warning'
56 \|| a:severity is? 'refactor'
63 call ale#linter#Define('hurl', {
65 \ 'output_stream': 'stderr',
66 \ 'executable': {b -> ale#Var(b, 'hurl_hurlfmt_executable')},
67 \ 'command': function('ale_linters#hurl#hurlfmt#GetCommand'),
68 \ 'callback': 'ale_linters#hurl#hurlfmt#HandleOutput',