2017-07-12 21:41:06 +00:00
|
|
|
Before:
|
2017-03-27 18:53:12 +00:00
|
|
|
runtime ale_linters/ruby/rubocop.vim
|
|
|
|
|
2017-07-12 21:41:06 +00:00
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The rubocop handler should parse lines correctly):
|
2017-03-27 18:53:12 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 83,
|
|
|
|
\ 'col': 29,
|
2017-07-09 14:48:04 +00:00
|
|
|
\ 'end_col': 35,
|
2017-11-14 16:50:15 +00:00
|
|
|
\ 'text': 'Prefer single-quoted strings...',
|
|
|
|
\ 'code': 'Style/SomeCop',
|
2017-03-27 18:53:12 +00:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 12,
|
|
|
|
\ 'col': 2,
|
2017-07-09 14:48:04 +00:00
|
|
|
\ 'end_col': 2,
|
2017-11-14 16:50:15 +00:00
|
|
|
\ 'text': 'Some error',
|
|
|
|
\ 'code': 'Style/SomeOtherCop',
|
2017-03-27 18:53:12 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 10,
|
|
|
|
\ 'col': 5,
|
2017-07-09 14:48:04 +00:00
|
|
|
\ 'end_col': 12,
|
2017-11-14 16:50:15 +00:00
|
|
|
\ 'text': 'Regular warning',
|
|
|
|
\ 'code': 'Style/WarningCop',
|
2017-03-27 18:53:12 +00:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 11,
|
|
|
|
\ 'col': 1,
|
2017-07-09 14:48:04 +00:00
|
|
|
\ 'end_col': 1,
|
2017-11-14 16:50:15 +00:00
|
|
|
\ 'text': 'Another error',
|
|
|
|
\ 'code': 'Style/SpaceBeforeBlockBraces',
|
2017-03-27 18:53:12 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
2018-12-10 21:02:32 +00:00
|
|
|
\ ale#ruby#HandleRubocopOutput(347, [
|
2017-07-09 14:48:04 +00:00
|
|
|
\ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[{"path":"my_great_file.rb","offenses":[{"severity":"convention","message":"Prefer single-quoted strings...","cop_name":"Style/SomeCop","corrected":false,"location":{"line":83,"column":29,"length":7}},{"severity":"fatal","message":"Some error","cop_name":"Style/SomeOtherCop","corrected":false,"location":{"line":12,"column":2,"length":1}},{"severity":"warning","message":"Regular warning","cop_name":"Style/WarningCop","corrected":false,"location":{"line":10,"column":5,"length":8}},{"severity":"error","message":"Another error","cop_name":"Style/SpaceBeforeBlockBraces","corrected":false,"location":{"line":11,"column":1,"length":1}}]}],"summary":{"offense_count":4,"target_file_count":1,"inspected_file_count":1}}'
|
2017-03-27 18:53:12 +00:00
|
|
|
\ ])
|
|
|
|
|
2017-07-12 23:42:54 +00:00
|
|
|
Execute(The rubocop handler should handle when files are checked and no offenses are found):
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
2018-12-10 21:02:32 +00:00
|
|
|
\ ale#ruby#HandleRubocopOutput(347, [
|
2017-07-12 23:42:54 +00:00
|
|
|
\ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[{"path":"my_great_file.rb","offenses":[]}],"summary":{"offense_count":0,"target_file_count":1,"inspected_file_count":1}}'
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
Execute(The rubocop handler should handle when no files are checked):
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
2018-12-10 21:02:32 +00:00
|
|
|
\ ale#ruby#HandleRubocopOutput(347, [
|
2017-07-12 23:42:54 +00:00
|
|
|
\ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[],"summary":{"offense_count":0,"target_file_count":0,"inspected_file_count":0}}'
|
|
|
|
\ ])
|
|
|
|
|
2023-09-16 21:22:01 +00:00
|
|
|
Execute(The rubocop handler should handle empty output):
|
|
|
|
AssertEqual [], ale#ruby#HandleRubocopOutput(347, ['{}'])
|
|
|
|
AssertEqual [], ale#ruby#HandleRubocopOutput(347, [])
|