From ff5c6b050955577322c50ffbae15f722d6d82b18 Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 15 Nov 2017 10:11:32 +0000 Subject: [PATCH] #852 - Capture error codes for ansible-lint --- ale_linters/ansible/ansible_lint.vim | 3 ++- test/handler/test_ansible_lint_handler.vader | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ale_linters/ansible/ansible_lint.vim b/ale_linters/ansible/ansible_lint.vim index 7d68cde..27c9632 100644 --- a/ale_linters/ansible/ansible_lint.vim +++ b/ale_linters/ansible/ansible_lint.vim @@ -31,7 +31,8 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, - \ 'text': l:code . ': ' . l:match[5], + \ 'text': l:match[5], + \ 'code': l:code, \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', \}) endif diff --git a/test/handler/test_ansible_lint_handler.vader b/test/handler/test_ansible_lint_handler.vader index 3a86429..cd6e513 100644 --- a/test/handler/test_ansible_lint_handler.vader +++ b/test/handler/test_ansible_lint_handler.vader @@ -12,7 +12,8 @@ Execute(The ansible-lint handler should handle basic errors): \ 'lnum': 35, \ 'col': 0, \ 'type': 'E', - \ 'text': 'EANSIBLE0002: Trailing whitespace', + \ 'text': 'Trailing whitespace', + \ 'code': 'EANSIBLE0002', \ }, \ ], \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [ @@ -26,7 +27,8 @@ Execute (The ansible-lint handler should handle names with spaces): \ 'lnum': 6, \ 'col': 6, \ 'type': 'E', - \ 'text': 'E111: indentation is not a multiple of four', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', \ }, \ ], \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [