2017-04-20 02:37:08 -04:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/ruby/reek.vim
|
|
|
|
|
|
|
|
After:
|
2017-07-26 19:45:25 -04:00
|
|
|
call ale#linter#Reset()
|
2017-04-20 02:37:08 -04:00
|
|
|
|
|
|
|
Execute(The reek handler should parse JSON correctly, with only context enabled):
|
2017-07-26 19:45:25 -04:00
|
|
|
let g:ale_ruby_reek_show_context = 1
|
|
|
|
let g:ale_ruby_reek_show_wiki_link = 0
|
2017-04-20 02:37:08 -04:00
|
|
|
|
2017-07-26 19:45:25 -04:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 12,
|
2017-11-18 19:54:09 -05:00
|
|
|
\ 'text': 'Context#method violates rule number one',
|
|
|
|
\ 'code': 'Rule1',
|
2017-07-26 19:45:25 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 34,
|
2017-11-18 19:54:09 -05:00
|
|
|
\ 'text': 'Context#method violates rule number two',
|
|
|
|
\ 'code': 'Rule2',
|
2017-07-26 19:45:25 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 56,
|
2017-11-18 19:54:09 -05:00
|
|
|
\ 'text': 'Context#method violates rule number two',
|
|
|
|
\ 'code': 'Rule2',
|
2017-07-26 19:45:25 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#ruby#reek#Handle(347, [
|
|
|
|
\ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"},{"context":"Context#method","lines":[34, 56],"message":"violates rule number two","smell_type":"Rule2","source":"/home/user/file.rb","name":"bad code","count":2,"wiki_link":"https://example.com/Rule1.md"}]'
|
|
|
|
\ ])
|
2017-04-20 02:37:08 -04:00
|
|
|
|
|
|
|
Execute(The reek handler should parse JSON correctly, with no context or wiki links):
|
2017-07-26 19:45:25 -04:00
|
|
|
let g:ale_ruby_reek_show_context = 0
|
|
|
|
let g:ale_ruby_reek_show_wiki_link = 0
|
2017-04-20 02:37:08 -04:00
|
|
|
|
2017-07-26 19:45:25 -04:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 12,
|
2017-11-18 19:54:09 -05:00
|
|
|
\ 'text': 'violates rule number one',
|
|
|
|
\ 'code': 'Rule1',
|
2017-07-26 19:45:25 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#ruby#reek#Handle(347, [
|
|
|
|
\ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]'
|
|
|
|
\ ])
|
2017-04-20 02:37:08 -04:00
|
|
|
|
|
|
|
Execute(The reek handler should parse JSON correctly, with both context and wiki links):
|
2017-07-26 19:45:25 -04:00
|
|
|
let g:ale_ruby_reek_show_context = 1
|
|
|
|
let g:ale_ruby_reek_show_wiki_link = 1
|
2017-04-20 02:37:08 -04:00
|
|
|
|
2017-07-26 19:45:25 -04:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 12,
|
2017-11-18 19:54:09 -05:00
|
|
|
\ 'text': 'Context#method violates rule number one [https://example.com/Rule1.md]',
|
|
|
|
\ 'code': 'Rule1',
|
2017-07-26 19:45:25 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#ruby#reek#Handle(347, [
|
|
|
|
\ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]'
|
|
|
|
\ ])
|
2017-04-20 02:37:08 -04:00
|
|
|
|
|
|
|
Execute(The reek handler should parse JSON correctly when there is no output from reek):
|
2017-07-26 19:45:25 -04:00
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#ruby#reek#Handle(347, [
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
Execute(The reek handler should handle garbage output):
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#ruby#reek#Handle(347, [
|
|
|
|
\ 'No such command in 2.4.1 of ruby',
|
|
|
|
\ ])
|