Merge pull request #1869 from Steap/feature/gitlint-ignore-whitespace
gitcommit: fully implement warn_about_trailing_whitespace
This commit is contained in:
commit
c1f0956d9b
@ -23,8 +23,10 @@ function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:code = l:match[2]
|
let l:code = l:match[2]
|
||||||
|
|
||||||
if l:code is# 'T2' && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||||
continue
|
if l:code is# 'T2' || l:code is# 'B2'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:item = {
|
let l:item = {
|
||||||
|
@ -61,6 +61,19 @@ Execute(Disabling trailing whitespace warnings should work):
|
|||||||
\ '8: T2 Trailing whitespace',
|
\ '8: T2 Trailing whitespace',
|
||||||
\])
|
\])
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 8,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Trailing whitespace',
|
||||||
|
\ 'code': 'B2',
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
|
||||||
|
\ '8: B2 Trailing whitespace',
|
||||||
|
\])
|
||||||
|
|
||||||
let b:ale_warn_about_trailing_whitespace = 0
|
let b:ale_warn_about_trailing_whitespace = 0
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
@ -68,3 +81,9 @@ Execute(Disabling trailing whitespace warnings should work):
|
|||||||
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
|
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
|
||||||
\ '8: T2 Trailing whitespace',
|
\ '8: T2 Trailing whitespace',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [],
|
||||||
|
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
|
||||||
|
\ '8: B2 Trailing whitespace',
|
||||||
|
\ ])
|
||||||
|
Loading…
Reference in New Issue
Block a user