mirror of
https://github.com/dense-analysis/ale
synced 2024-12-22 22:23:43 +00:00
#852 - Capture error codes for reek
This commit is contained in:
parent
c012563984
commit
7123f7236b
@ -13,6 +13,7 @@ function! ale_linters#ruby#reek#Handle(buffer, lines) abort
|
||||
\ 'lnum': l:location,
|
||||
\ 'type': 'W',
|
||||
\ 'text': s:BuildText(a:buffer, l:error),
|
||||
\ 'code': l:error.smell_type,
|
||||
\})
|
||||
endfor
|
||||
endfor
|
||||
@ -21,19 +22,19 @@ function! ale_linters#ruby#reek#Handle(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
function! s:BuildText(buffer, error) abort
|
||||
let l:text = a:error.smell_type . ':'
|
||||
let l:parts = []
|
||||
|
||||
if ale#Var(a:buffer, 'ruby_reek_show_context')
|
||||
let l:text .= ' ' . a:error.context
|
||||
call add(l:parts, a:error.context)
|
||||
endif
|
||||
|
||||
let l:text .= ' ' . a:error.message
|
||||
call add(l:parts, a:error.message)
|
||||
|
||||
if ale#Var(a:buffer, 'ruby_reek_show_wiki_link')
|
||||
let l:text .= ' [' . a:error.wiki_link . ']'
|
||||
call add(l:parts, '[' . a:error.wiki_link . ']')
|
||||
endif
|
||||
|
||||
return l:text
|
||||
return join(l:parts, ' ')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
|
@ -12,17 +12,20 @@ Execute(The reek handler should parse JSON correctly, with only context enabled)
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 12,
|
||||
\ 'text': 'Rule1: Context#method violates rule number one',
|
||||
\ 'text': 'Context#method violates rule number one',
|
||||
\ 'code': 'Rule1',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 34,
|
||||
\ 'text': 'Rule2: Context#method violates rule number two',
|
||||
\ 'text': 'Context#method violates rule number two',
|
||||
\ 'code': 'Rule2',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 56,
|
||||
\ 'text': 'Rule2: Context#method violates rule number two',
|
||||
\ 'text': 'Context#method violates rule number two',
|
||||
\ 'code': 'Rule2',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ ],
|
||||
@ -38,7 +41,8 @@ Execute(The reek handler should parse JSON correctly, with no context or wiki li
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 12,
|
||||
\ 'text': 'Rule1: violates rule number one',
|
||||
\ 'text': 'violates rule number one',
|
||||
\ 'code': 'Rule1',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ ],
|
||||
@ -54,7 +58,8 @@ Execute(The reek handler should parse JSON correctly, with both context and wiki
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 12,
|
||||
\ 'text': 'Rule1: Context#method violates rule number one [https://example.com/Rule1.md]',
|
||||
\ 'text': 'Context#method violates rule number one [https://example.com/Rule1.md]',
|
||||
\ 'code': 'Rule1',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ ],
|
||||
|
Loading…
Reference in New Issue
Block a user