From 342e83db60dd929cbef1d00e1864e607760ca9bb Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 16 Aug 2017 10:37:36 +0100 Subject: [PATCH] Include the ruleName for errors in tslint problems --- ale_linters/typescript/tslint.vim | 4 +++- test/handler/test_tslint_handler.vader | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim index cdc896e..4db5094 100644 --- a/ale_linters/typescript/tslint.vim +++ b/ale_linters/typescript/tslint.vim @@ -18,7 +18,9 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort if ale#path#IsBufferPath(a:buffer, l:error.name) call add(l:output, { \ '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, \ 'col': l:error.startPosition.character + 1, \ 'end_lnum': l:error.endPosition.line + 1, diff --git a/test/handler/test_tslint_handler.vader b/test/handler/test_tslint_handler.vader index 704123d..a27657e 100644 --- a/test/handler/test_tslint_handler.vader +++ b/test/handler/test_tslint_handler.vader @@ -17,7 +17,7 @@ Execute(The tslint handler should parse lines correctly): \ 'col': 15, \ 'end_lnum': 1, \ 'end_col': 15, - \ 'text': 'Missing semicolon', + \ 'text': 'semicolon: Missing semicolon', \ 'type': 'E', \ }, \ { @@ -33,7 +33,7 @@ Execute(The tslint handler should parse lines correctly): \ 'col': 9, \ 'end_lnum': 31, \ 'end_col': 20, - \ 'text': 'Calls to console.log are not allowed.', + \ 'text': 'no-console: Calls to console.log are not allowed.', \ 'type': 'E', \ }, \ ], @@ -72,7 +72,6 @@ Execute(The tslint handler should parse lines correctly): \ 'innerText': ';' \ }, \ 'name': 'app/test.ts', - \ 'ruleName': 'something', \ 'ruleSeverity': 'WARNING', \ 'startPosition': { \ 'character': 7,