diff options
-rw-r--r-- | ale_linters/ansible/ansible_lint.vim | 3 | ||||
-rw-r--r-- | autoload/ale/handlers/cpplint.vim | 5 | ||||
-rw-r--r-- | doc/ale.txt | 8 | ||||
-rw-r--r-- | test/handler/test_ansible_lint_handler.vader | 6 | ||||
-rw-r--r-- | test/handler/test_cpplint_handler.vader | 14 |
5 files changed, 22 insertions, 14 deletions
diff --git a/ale_linters/ansible/ansible_lint.vim b/ale_linters/ansible/ansible_lint.vim index 7d68cde3..27c96320 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/autoload/ale/handlers/cpplint.vim b/autoload/ale/handlers/cpplint.vim index 46078633..5c475a5c 100644 --- a/autoload/ale/handlers/cpplint.vim +++ b/autoload/ale/handlers/cpplint.vim @@ -4,14 +4,15 @@ function! ale#handlers#cpplint#HandleCppLintFormat(buffer, lines) abort " Look for lines like the following. " test.cpp:5: Estra space after ( in function call [whitespace/parents] [4] - let l:pattern = '^.\{-}:\(\d\+\): \(.\+\)' + let l:pattern = '^.\{-}:\(\d\+\): *\(.\+\) *\[\(.*/.*\)\] ' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': 0, - \ 'text': l:match[2], + \ 'text': join(split(l:match[2])), + \ 'code': l:match[3], \ 'type': 'W', \}) endfor diff --git a/doc/ale.txt b/doc/ale.txt index 7da027b6..9947d091 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -1700,9 +1700,11 @@ ale#engine#EscapeCommandPart(command_part) *ale#engine#EscapeCommandPart()* ale#engine#GetLoclist(buffer) *ale#engine#GetLoclist()* - Given a buffer number, this function will rerurn the list of warnings and - errors reported by ALE for a given buffer in the format accepted by - |setqflist()|. + Given a buffer number, this function will return the list of problems + reported by ALE for a given buffer in the format accepted by |setqflist()|. + + A reference to the buffer's list of problems will be returned. The list must + be copied before applying |map()| or |filter()|. ale#engine#ManageFile(buffer, filename) *ale#engine#ManageFile()* diff --git a/test/handler/test_ansible_lint_handler.vader b/test/handler/test_ansible_lint_handler.vader index 3a86429c..cd6e513e 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(''), [ diff --git a/test/handler/test_cpplint_handler.vader b/test/handler/test_cpplint_handler.vader index 6df84ccd..d8d7b8b7 100644 --- a/test/handler/test_cpplint_handler.vader +++ b/test/handler/test_cpplint_handler.vader @@ -1,6 +1,9 @@ Before: runtime ale_linters/cpp/cpplint.vim +After: + call ale#linter#Reset() + Execute(cpplint warnings from included files should be parsed correctly): AssertEqual @@ -8,20 +11,19 @@ Execute(cpplint warnings from included files should be parsed correctly): \ { \ 'lnum': 5, \ 'col': 0, - \ 'text': ' Estra space after ( in function call [whitespace/parents] [4]', + \ 'text': 'Extra space after ( in function call', + \ 'code': 'whitespace/parents', \ 'type': 'W', \ }, \ { \ 'lnum': 120, \ 'col': 0, - \ 'text': ' At least two spaces is best between code and comments [whitespace/comments] [2]', + \ 'text': 'At least two spaces is best between code and comments', + \ 'code': 'whitespace/comments', \ 'type': 'W', \ }, \ ], \ ale#handlers#cpplint#HandleCppLintFormat(347, [ - \ 'test.cpp:5: Estra space after ( in function call [whitespace/parents] [4]', + \ 'test.cpp:5: Extra space after ( in function call [whitespace/parents] [4]', \ 'keymap_keys.hpp:120: At least two spaces is best between code and comments [whitespace/comments] [2]', \ ]) - -After: - call ale#linter#Reset() |