2017-12-20 05:10:07 -05:00
|
|
|
Before:
|
2018-06-03 05:45:40 -04:00
|
|
|
Save g:ale_warn_about_trailing_whitespace
|
|
|
|
|
|
|
|
let g:ale_warn_about_trailing_whitespace = 1
|
|
|
|
|
|
|
|
runtime ale_linters/gitcommit/gitlint.vim
|
2017-12-20 05:10:07 -05:00
|
|
|
|
|
|
|
After:
|
2018-06-03 05:45:40 -04:00
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! b:ale_warn_about_trailing_whitespace
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
2017-12-20 05:10:07 -05:00
|
|
|
|
|
|
|
Execute(The gitlint handler should handle basic warnings and syntax errors):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'type': 'E',
|
2017-12-20 05:46:08 -05:00
|
|
|
\ 'text': 'Body message is missing',
|
|
|
|
\ 'code': 'B6',
|
2017-12-20 05:10:07 -05:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 2,
|
|
|
|
\ 'type': 'E',
|
2017-12-20 05:46:08 -05:00
|
|
|
\ 'text': 'Second line is not empty: "to send to upstream"',
|
|
|
|
\ 'code': 'B4',
|
2017-12-20 05:10:07 -05:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 3,
|
|
|
|
\ 'type': 'E',
|
2017-12-20 05:46:08 -05:00
|
|
|
\ 'text': 'Body message is too short (19<20): "to send to upstream"',
|
|
|
|
\ 'code': 'B5',
|
2017-12-20 05:10:07 -05:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 8,
|
|
|
|
\ 'type': 'E',
|
2017-12-20 05:46:08 -05:00
|
|
|
\ 'text': 'Title exceeds max length (92>72): "some very long commit subject line where the author can''t wait to explain what he just fixed"',
|
|
|
|
\ 'code': 'T1',
|
2017-12-20 05:10:07 -05:00
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#gitcommit#gitlint#Handle(1, [
|
|
|
|
\ '1: B6 Body message is missing',
|
|
|
|
\ '2: B4 Second line is not empty: "to send to upstream"',
|
|
|
|
\ '3: B5 Body message is too short (19<20): "to send to upstream"',
|
|
|
|
\ '8: T1 Title exceeds max length (92>72): "some very long commit subject line where the author can''t wait to explain what he just fixed"'
|
|
|
|
\ ])
|
|
|
|
|
2018-06-03 05:45:40 -04:00
|
|
|
Execute(Disabling trailing whitespace warnings should work):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 8,
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': 'Trailing whitespace',
|
|
|
|
\ 'code': 'T2',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
|
|
|
|
\ '8: T2 Trailing whitespace',
|
|
|
|
\])
|
|
|
|
|
|
|
|
let b:ale_warn_about_trailing_whitespace = 0
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
|
|
|
|
\ '8: T2 Trailing whitespace',
|
|
|
|
\ ])
|