Include the ruleName for errors in tslint problems

This commit is contained in:
w0rp 2017-08-16 10:37:36 +01:00
parent 17a76a7403
commit 342e83db60
2 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,9 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
if ale#path#IsBufferPath(a:buffer, l:error.name) if ale#path#IsBufferPath(a:buffer, l:error.name)
call add(l:output, { call add(l:output, {
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'), \ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
\ 'text': l:error.failure, \ 'text': has_key(l:error, 'ruleName')
\ ? l:error.ruleName . ': ' . l:error.failure
\ : l:error.failure,
\ 'lnum': l:error.startPosition.line + 1, \ 'lnum': l:error.startPosition.line + 1,
\ 'col': l:error.startPosition.character + 1, \ 'col': l:error.startPosition.character + 1,
\ 'end_lnum': l:error.endPosition.line + 1, \ 'end_lnum': l:error.endPosition.line + 1,

View File

@ -17,7 +17,7 @@ Execute(The tslint handler should parse lines correctly):
\ 'col': 15, \ 'col': 15,
\ 'end_lnum': 1, \ 'end_lnum': 1,
\ 'end_col': 15, \ 'end_col': 15,
\ 'text': 'Missing semicolon', \ 'text': 'semicolon: Missing semicolon',
\ 'type': 'E', \ 'type': 'E',
\ }, \ },
\ { \ {
@ -33,7 +33,7 @@ Execute(The tslint handler should parse lines correctly):
\ 'col': 9, \ 'col': 9,
\ 'end_lnum': 31, \ 'end_lnum': 31,
\ 'end_col': 20, \ 'end_col': 20,
\ 'text': 'Calls to console.log are not allowed.', \ 'text': 'no-console: Calls to console.log are not allowed.',
\ 'type': 'E', \ 'type': 'E',
\ }, \ },
\ ], \ ],
@ -72,7 +72,6 @@ Execute(The tslint handler should parse lines correctly):
\ 'innerText': ';' \ 'innerText': ';'
\ }, \ },
\ 'name': 'app/test.ts', \ 'name': 'app/test.ts',
\ 'ruleName': 'something',
\ 'ruleSeverity': 'WARNING', \ 'ruleSeverity': 'WARNING',
\ 'startPosition': { \ 'startPosition': {
\ 'character': 7, \ 'character': 7,