2017-06-14 11:20:30 -04:00
|
|
|
Before:
|
2017-12-13 06:14:31 -05:00
|
|
|
runtime ale_linters/ansible/ansible_lint.vim
|
|
|
|
call ale#test#SetFilename('main.yml')
|
|
|
|
|
|
|
|
let b:ale_warn_about_trailing_whitespace = 1
|
2017-06-14 11:20:30 -04:00
|
|
|
|
|
|
|
After:
|
2017-12-13 06:14:31 -05:00
|
|
|
unlet! b:ale_warn_about_trailing_whitespace
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
2017-06-14 11:20:30 -04:00
|
|
|
|
|
|
|
Execute(The ansible-lint handler should handle basic errors):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 35,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'type': 'E',
|
2017-11-15 05:11:32 -05:00
|
|
|
\ 'text': 'Trailing whitespace',
|
|
|
|
\ 'code': 'EANSIBLE0002',
|
2017-06-14 11:20:30 -04:00
|
|
|
\ },
|
|
|
|
\ ],
|
2017-07-03 18:16:39 -04:00
|
|
|
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
|
2017-09-13 19:11:17 -04:00
|
|
|
\ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace',
|
2017-06-14 11:20:30 -04:00
|
|
|
\ ])
|
|
|
|
|
2017-12-13 06:14:31 -05:00
|
|
|
Execute(The ansible-lint handler should supress trailing whitespace output when the option is used):
|
|
|
|
let b:ale_warn_about_trailing_whitespace = 0
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
|
|
|
|
\ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace',
|
|
|
|
\ ])
|
|
|
|
|
2017-06-14 11:20:30 -04:00
|
|
|
Execute (The ansible-lint handler should handle names with spaces):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 6,
|
|
|
|
\ 'col': 6,
|
|
|
|
\ 'type': 'E',
|
2017-11-15 05:11:32 -05:00
|
|
|
\ 'text': 'indentation is not a multiple of four',
|
|
|
|
\ 'code': 'E111',
|
2017-06-14 11:20:30 -04:00
|
|
|
\ },
|
|
|
|
\ ],
|
2017-07-03 18:16:39 -04:00
|
|
|
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
|
2017-09-13 19:11:17 -04:00
|
|
|
\ fnamemodify(tempname(), ':h') . '/main.yml:6:6: E111 indentation is not a multiple of four',
|
2017-07-03 18:16:39 -04:00
|
|
|
\ ])
|
|
|
|
|
|
|
|
Execute (The ansible-lint handler should ignore errors from other files):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
|
|
|
|
\ '/foo/bar/roles/main.yml:6:6: E111 indentation is not a multiple of four',
|
2017-06-14 11:20:30 -04:00
|
|
|
\ ])
|