summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-03 23:16:39 +0100
committerw0rp <devw0rp@gmail.com>2017-07-03 23:16:39 +0100
commitbb293b297c17e0b53d8cfc55ab7bebfcb37dc233 (patch)
tree44883b80c59f98cc03578473d25108b4214e2431 /ale_linters
parenta1cf7f67a10b03e40596b2c48a2cbe11d9ce38a4 (diff)
downloadale-bb293b297c17e0b53d8cfc55ab7bebfcb37dc233.zip
Fix #216 - Filter out errors for other files for ansible-lint
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/ansible/ansible_lint.vim20
1 files changed, 10 insertions, 10 deletions
diff --git a/ale_linters/ansible/ansible_lint.vim b/ale_linters/ansible/ansible_lint.vim
index 3efd95fd..192e65b9 100644
--- a/ale_linters/ansible/ansible_lint.vim
+++ b/ale_linters/ansible/ansible_lint.vim
@@ -15,11 +15,11 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
" Matches patterns line the following:
"
" test.yml:35: [EANSIBLE0002] Trailing whitespace
- let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
+ let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
- let l:code = l:match[3]
+ let l:code = l:match[4]
if (l:code ==# 'EANSIBLE002')
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
@@ -27,14 +27,14 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
continue
endif
- let l:item = {
- \ 'lnum': l:match[1] + 0,
- \ 'col': l:match[2] + 0,
- \ 'text': l:code . ': ' . l:match[4],
- \ 'type': l:code[:0] ==# 'E' ? 'E' : 'W',
- \}
-
- call add(l:output, l:item)
+ if ale#path#IsBufferPath(a:buffer, l:match[1])
+ call add(l:output, {
+ \ 'lnum': l:match[2] + 0,
+ \ 'col': l:match[3] + 0,
+ \ 'text': l:code . ': ' . l:match[5],
+ \ 'type': l:code[:0] ==# 'E' ? 'E' : 'W',
+ \})
+ endif
endfor
return l:output