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: lucas-str <lucas.sturelle@ik.me>
2 " Description: Integration of npm-groovy-lint for Groovy files.
4 call ale#Set('groovy_npmgroovylint_executable', 'npm-groovy-lint')
5 call ale#Set('groovy_npmgroovylint_options', '--loglevel warning')
7 function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
8 let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
10 return '%e --failon none --output json'
11 \ . (!empty(l:options) ? ' ' . l:options : '')
15 function! ale_linters#groovy#npmgroovylint#Handle(buffer, lines) abort
17 let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
19 for [l:filename, l:file] in items(get(l:json, 'files', {}))
20 for l:error in get(l:file, 'errors', [])
22 \ 'filename': l:filename,
23 \ 'lnum': l:error.line,
24 \ 'text': l:error.msg,
25 \ 'type': toupper(l:error.severity[0]),
28 if has_key(l:error, 'range')
29 let l:output_line.col = l:error.range.start.character
30 let l:output_line.end_col = l:error.range.end.character
31 let l:output_line.end_lnum = l:error.range.end.line
34 call add(l:output, l:output_line)
41 call ale#linter#Define('groovy', {
42 \ 'name': 'npm-groovy-lint',
43 \ 'executable': {b -> ale#Var(b, 'groovy_npmgroovylint_executable')},
44 \ 'command': function('ale_linters#groovy#npmgroovylint#GetCommand'),
45 \ 'callback': 'ale_linters#groovy#npmgroovylint#Handle',