Skip to content

Commit

Permalink
Add stdin ("-") to the command-line arguments of ansible-lint >=5.0.0 (
Browse files Browse the repository at this point in the history
…#3786)

* Added an explicit stdin argument to ansible-lint >=5.0.0 (ansible_lint.vim).

This commit fixes the issue "<<NO OUTPUT RETURNED>>":
```
:ALEInfo
(finished - exit code 0) ['/bin/bash', '-c', ''ansible-lint'' --parseable-severity -x yaml < ''/tmp/vVyvn4B/7/test2.yml'']
<<<NO OUTPUT RETURNED>>>'
```

Reason: Ansible-lint ignores stdin when "-" or "/dev/stdin" is not
specified explicitly.

Tested with: ansible-lint 5.0.12 using ansible 2.11.2

* Update ansible-lint tests.
  • Loading branch information
jamescherti authored Jul 5, 2021
1 parent 87e079a commit af13c35
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ale_linters/ansible/ansible_lint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ endfunction

function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
let l:commands = {
\ '>=5.0.0': '%e --parseable-severity -x yaml',
\ '>=5.0.0': '%e --parseable-severity -x yaml -',
\ '<5.0.0': '%e -p %t'
\}
let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']
Expand Down
2 changes: 1 addition & 1 deletion test/linter/test_ansible_lint.vader
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Execute(The ansible_lint version <5.0.0 command callback should return default s

Execute(The ansible_lint version >=5.0.0 command callback should return default string):
GivenCommandOutput ['v5.1.2']
AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --parseable-severity -x yaml'
AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --parseable-severity -x yaml -'

Execute(The ansible_lint executable should be configurable):
let g:ale_ansible_ansible_lint_executable = '~/.local/bin/ansible-lint'
Expand Down

0 comments on commit af13c35

Please sign in to comment.