summaryrefslogtreecommitdiff
path: root/ale_linters/ansible
diff options
context:
space:
mode:
authorix5 <ix5@users.noreply.github.com>2018-10-18 10:19:27 +0200
committerw0rp <w0rp@users.noreply.github.com>2018-10-18 09:19:27 +0100
commitb8359c1114229737563bde4e2478ca2309ce6e7a (patch)
tree8a1c4ec9f95f259872143d449440d93222797f8f /ale_linters/ansible
parent3b38a83ae9c221e0f4589f087bfb6b43056e3943 (diff)
downloadale-b8359c1114229737563bde4e2478ca2309ce6e7a.zip
Allow custom executable for ansible linters (#1977)
* Allow custom executable for ansible linters * Add ansible-lint tests * ansible-lint: simplify linter command * Rename linter "ansible" to "ansible_lint" * Add ansible-lint options to documentation * Add alias ansible-lint for ansible_lint
Diffstat (limited to 'ale_linters/ansible')
-rw-r--r--ale_linters/ansible/ansible_lint.vim13
1 files changed, 10 insertions, 3 deletions
diff --git a/ale_linters/ansible/ansible_lint.vim b/ale_linters/ansible/ansible_lint.vim
index 0b3b39c8..99fff6c3 100644
--- a/ale_linters/ansible/ansible_lint.vim
+++ b/ale_linters/ansible/ansible_lint.vim
@@ -1,6 +1,12 @@
" Author: Bjorn Neergaard <bjorn@neersighted.com>
" Description: ansible-lint for ansible-yaml files
+call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
+
+function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
+endfunction
+
function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
for l:line in a:lines[:10]
if match(l:line, '^Traceback') >= 0
@@ -42,8 +48,9 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
endfunction
call ale#linter#Define('ansible', {
-\ 'name': 'ansible',
-\ 'executable': 'ansible',
-\ 'command': 'ansible-lint -p %t',
+\ 'name': 'ansible_lint',
+\ 'aliases': ['ansible', 'ansible-lint'],
+\ 'executable_callback': 'ale_linters#ansible#ansible_lint#GetExecutable',
+\ 'command': '%e -p %t',
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
\})