summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-12 22:41:06 +0100
committerw0rp <devw0rp@gmail.com>2017-07-12 22:41:06 +0100
commit588595419739e3fec9cad921824e0e07aadb440d (patch)
treee1fdfc0f9045f49b472d16b20b3f2c18c6742041 /ale_linters
parentbc32e24203159945dcf3906a5e08261ccb06e065 (diff)
downloadale-588595419739e3fec9cad921824e0e07aadb440d.zip
Fix #760 - Report problems with configuration files for rubocop
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/ruby/rubocop.vim15
1 files changed, 12 insertions, 3 deletions
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index 5c1a60e7..9d315be1 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -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',
\})