Update argon

This commit is contained in:
Julian Ospald 2018-06-20 15:49:50 +02:00
parent c58eab1c0e
commit 2f0190fad6
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
1 changed files with 25 additions and 20 deletions

View File

@ -27,28 +27,33 @@ function! ale_linters#haskell#argon#Handle(buffer, lines) abort
let l:output = []
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
for l:block in l:error.blocks
let l:complexity = l:block.complexity
if !has_key(l:error, 'blocks')
" this cannot be formatted properly into an ALE error
execute 'echom ''[argon] '' l:error.message'
return l:output
endif
for l:block in l:error.blocks
let l:complexity = l:block.complexity
if l:complexity >= ale#Var(a:buffer, 'haskell_argon_error_level')
let l:type = 'E'
let l:max_c = ale#Var(a:buffer, 'haskell_argon_error_level')
elseif l:complexity >= ale#Var(a:buffer, 'haskell_argon_warn_level')
let l:type = 'W'
let l:max_c = ale#Var(a:buffer, 'haskell_argon_warn_level')
else
let l:type = 'I'
let l:max_c = ale#Var(a:buffer, 'haskell_argon_info_level')
endif
if l:complexity >= ale#Var(a:buffer, 'haskell_argon_error_level')
let l:type = 'E'
let l:max_c = ale#Var(a:buffer, 'haskell_argon_error_level')
elseif l:complexity >= ale#Var(a:buffer, 'haskell_argon_warn_level')
let l:type = 'W'
let l:max_c = ale#Var(a:buffer, 'haskell_argon_warn_level')
else
let l:type = 'I'
let l:max_c = ale#Var(a:buffer, 'haskell_argon_info_level')
endif
call add(l:output, {
\ 'filename': l:error.path,
\ 'lnum': str2nr(l:block.lineno),
\ 'col': str2nr(l:block.col),
\ 'text': l:block.name . ': cyclomatic complexity of ' . l:complexity,
\ 'type': l:type,
\})
endfor
call add(l:output, {
\ 'filename': l:error.path,
\ 'lnum': l:block.lineno,
\ 'col': l:block.col,
\ 'text': l:block.name . ': cyclomatic complexity of ' . l:complexity,
\ 'type': l:type,
\})
endfor
endfor
return l:output