#810 - Handle output which is not JSON in many linters

This commit is contained in:
w0rp committed 2017-07-27 00:45:25 +01:00
1 parent db4d68eae7
commit fa33faad9e
11 files changed
+101 -143

No files matched your search

+2 -12
View File
@@ -5,20 +5,10 @@ let g:ale_ruby_brakeman_options =
\ get(g:, 'ale_ruby_brakeman_options', '')
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
if len(a:lines) == 0
return []
endif
try
let l:result = json_decode(join(a:lines, ''))
catch /E474/
" Ignore invalid JSON
return []
endtry
let l:output = []
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
for l:warning in l:result.warnings
for l:warning in get(l:json, 'warnings', [])
" Brakeman always outputs paths relative to the Rails app root
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
let l:warning_file = l:rails_root . '/' . l:warning.file