summaryrefslogtreecommitdiff
path: root/ale_linters/crystal
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-27 00:45:25 +0100
committerw0rp <devw0rp@gmail.com>2017-07-27 00:45:25 +0100
commitfa33faad9ed6da220394bd2abec2e1bdcd19edba (patch)
tree288fa6a1f8d2231d3e7b3b8e2915730906d6920e /ale_linters/crystal
parentdb4d68eae75c071b2a6521fe8587102f5b781efe (diff)
downloadale-fa33faad9ed6da220394bd2abec2e1bdcd19edba.zip
#810 - Handle output which is not JSON in many linters
Diffstat (limited to 'ale_linters/crystal')
-rw-r--r--ale_linters/crystal/crystal.vim30
1 files changed, 10 insertions, 20 deletions
diff --git a/ale_linters/crystal/crystal.vim b/ale_linters/crystal/crystal.vim
index fd076e02..81579d63 100644
--- a/ale_linters/crystal/crystal.vim
+++ b/ale_linters/crystal/crystal.vim
@@ -4,31 +4,21 @@
function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
let l:output = []
- let l:lines = join(a:lines, '')
-
- if !empty(l:lines)
- let l:errors = json_decode(l:lines)
-
- for l:error in l:errors
- call add(l:output, {
- \ 'bufnr': a:buffer,
- \ 'lnum': l:error.line + 0,
- \ 'col': l:error.column + 0,
- \ 'text': l:error.message,
- \ 'type': 'E',
- \})
- endfor
- endif
+ for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
+ call add(l:output, {
+ \ 'lnum': l:error.line + 0,
+ \ 'col': l:error.column + 0,
+ \ 'text': l:error.message,
+ \})
+ endfor
return l:output
endfunction
function! ale_linters#crystal#crystal#GetCommand(buffer) abort
- let l:crystal_cmd = 'crystal build -f json --no-codegen --no-color -o '
- let l:crystal_cmd .= ale#Escape(g:ale#util#nul_file)
- let l:crystal_cmd .= ' %s'
-
- return l:crystal_cmd
+ return 'crystal build -f json --no-codegen --no-color -o '
+ \ . ale#Escape(g:ale#util#nul_file)
+ \ . ' %s'
endfunction
call ale#linter#Define('crystal', {