Fix #760 - Report problems with configuration files for rubocop

This commit is contained in:
w0rp
2017-07-12 22:41:06 +01:00
parent bc32e24203
commit 5885954197
2 changed files with 34 additions and 6 deletions

View File

@@ -14,11 +14,19 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
endfunction
function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
if len(a:lines) == 0
return []
if empty(a:lines)
return []
endif
let l:errors = json_decode(a:lines[0])
try
let l:errors = json_decode(a:lines[0])
catch
return [{
\ 'lnum': 1,
\ 'text': 'rubocop configuration error (type :ALEDetail for more information)',
\ 'detail': join(a:lines, "\n"),
\}]
endtry
let l:output = []
@@ -51,4 +59,5 @@ call ale#linter#Define('ruby', {
\ 'executable_callback': 'ale#handlers#rubocop#GetExecutable',
\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
\ 'output_stream': 'both',
\})