mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Add support for project-local `ansible-lint` (via `uv`, `poetry`, and `pipenv`) when using the system-wide installed one is not possible or not desirable.
52 lines
2.1 KiB
Plaintext
52 lines
2.1 KiB
Plaintext
Before:
|
|
call ale#assert#SetUpLinterTest('ansible', 'ansible_lint')
|
|
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
|
|
|
After:
|
|
unlet! b:bin_dir
|
|
unlet! b:executable
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
Execute(The ansible_lint version <5.0.0 command callback should return default string):
|
|
GivenCommandOutput ['v4.1.2']
|
|
AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor -p %t'
|
|
|
|
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') . ' --nocolor --parseable-severity -x yaml %s'
|
|
|
|
Execute(The ansible_lint version >=6.0.0 command callback should return default string):
|
|
GivenCommandOutput ['v6.0.2']
|
|
AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor -f json -x yaml %s'
|
|
|
|
Execute(The ansible_lint executable should be configurable):
|
|
let g:ale_ansible_ansible_lint_executable = '~/.local/bin/ansible-lint'
|
|
GivenCommandOutput ['v4.1.2']
|
|
AssertLinter '~/.local/bin/ansible-lint',
|
|
\ ale#Escape('~/.local/bin/ansible-lint') . ' --nocolor -p %t'
|
|
|
|
Execute(pipenv is detected when ansible_ansible_lint_auto_pipenv is set):
|
|
let g:ale_ansible_ansible_lint_auto_pipenv = 1
|
|
call ale#test#SetFilename('../test-files/ansible/pipenv/script.yml')
|
|
|
|
GivenCommandOutput ['v25.6.1']
|
|
AssertLinterCwd expand('%:p:h')
|
|
AssertLinter 'pipenv', ale#Escape('pipenv') . ' run ansible-lint --nocolor -f json -x yaml %s'
|
|
|
|
Execute(poetry is detected when ansible_ansible_lint_auto_poetry is set):
|
|
let g:ale_ansible_ansible_lint_auto_poetry = 1
|
|
call ale#test#SetFilename('../test-files/ansible/poetry/script.yml')
|
|
|
|
GivenCommandOutput ['v25.6.1']
|
|
AssertLinterCwd expand('%:p:h')
|
|
AssertLinter 'poetry', ale#Escape('poetry') . ' run ansible-lint --nocolor -f json -x yaml %s'
|
|
|
|
Execute(uv is detected when ansible_ansible_lint_auto_uv is set):
|
|
let g:ale_ansible_ansible_lint_auto_uv = 1
|
|
call ale#test#SetFilename('../test-files/ansible/uv/script.yml')
|
|
|
|
GivenCommandOutput ['v25.6.1']
|
|
AssertLinterCwd expand('%:p:h')
|
|
AssertLinter 'uv', ale#Escape('uv') . ' run ansible-lint --nocolor -f json -x yaml %s'
|
|
|