summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-11-14 18:16:22 +0000
committerGitHub <noreply@github.com>2017-11-14 18:16:22 +0000
commit2e9cd978a23c60d061b4b4dd7fb46d2d2949e08e (patch)
treeaeface99c00c551296bb16cdab6033e0fe447656
parent48eb362fca164fd792a3b77a4cba888238aea084 (diff)
parent425482116ed4f8baa9e568be50968f412bd5ca0f (diff)
downloadale-2e9cd978a23c60d061b4b4dd7fb46d2d2949e08e.zip
Merge pull request #1129 from aliou/rubocop-cop-as-error-code
#852 - Capture error codes for Rubocop
-rw-r--r--ale_linters/ruby/rubocop.vim3
-rw-r--r--test/handler/test_rubocop_handler.vader12
2 files changed, 10 insertions, 5 deletions
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index 2a4388f2..777f457a 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -34,7 +34,8 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
\ 'lnum': l:error['location']['line'] + 0,
\ 'col': l:start_col,
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
- \ 'text': printf('%s [%s]', l:error['message'], l:error['cop_name']),
+ \ 'code': l:error['cop_name'],
+ \ 'text': l:error['message'],
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
\})
endfor
diff --git a/test/handler/test_rubocop_handler.vader b/test/handler/test_rubocop_handler.vader
index 4d3bbe29..ef0137d6 100644
--- a/test/handler/test_rubocop_handler.vader
+++ b/test/handler/test_rubocop_handler.vader
@@ -12,28 +12,32 @@ Execute(The rubocop handler should parse lines correctly):
\ 'lnum': 83,
\ 'col': 29,
\ 'end_col': 35,
- \ 'text': 'Prefer single-quoted strings... [Style/SomeCop]',
+ \ 'text': 'Prefer single-quoted strings...',
+ \ 'code': 'Style/SomeCop',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 12,
\ 'col': 2,
\ 'end_col': 2,
- \ 'text': 'Some error [Style/SomeOtherCop]',
+ \ 'text': 'Some error',
+ \ 'code': 'Style/SomeOtherCop',
\ 'type': 'E',
\ },
\ {
\ 'lnum': 10,
\ 'col': 5,
\ 'end_col': 12,
- \ 'text': 'Regular warning [Style/WarningCop]',
+ \ 'text': 'Regular warning',
+ \ 'code': 'Style/WarningCop',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 11,
\ 'col': 1,
\ 'end_col': 1,
- \ 'text': 'Another error [Style/SpaceBeforeBlockBraces]',
+ \ 'text': 'Another error',
+ \ 'code': 'Style/SpaceBeforeBlockBraces',
\ 'type': 'E',
\ },
\ ],