From c4fb7f949d7880a80e4b1879cf6cd5c2d251980e Mon Sep 17 00:00:00 2001 From: w0rp Date: Thu, 15 Sep 2016 13:08:21 +0100 Subject: [PATCH] Add an option disabling warnings about trailing whitespace, and use it in flake8. --- ale_linters/python/flake8.vim | 5 +++++ plugin/ale/aaflags.vim | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim index 8f33f9e..ba754fe 100644 --- a/ale_linters/python/flake8.vim +++ b/ale_linters/python/flake8.vim @@ -24,6 +24,11 @@ function! ale_linters#python#flake8#Handle(buffer, lines) let text = l:match[4] let type = code[0] ==# 'E' ? 'E' : 'W' + if code ==# 'W291' && !g:ale_warn_about_trailing_whitespace + " Skip warnings for trailing whitespace if the option is off. + continue + endif + " vcol is Needed to indicate that the column is a character. call add(output, { \ 'bufnr': a:buffer, diff --git a/plugin/ale/aaflags.vim b/plugin/ale/aaflags.vim index 70021a6..4fc74b4 100644 --- a/plugin/ale/aaflags.vim +++ b/plugin/ale/aaflags.vim @@ -40,3 +40,8 @@ endif if !exists('g:ale_echo_cursor') let g:ale_echo_cursor = 1 endif + +" This flag can be set to 0 to disable warnings for trailing whitespace +if !exists('g:ale_warn_about_trailing_whitespace') + let g:ale_warn_about_trailing_whitespace = 1 +endif