diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-28 10:08:34 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-28 10:08:34 +0000 |
commit | 0ab689db0a137f7f62a3856eeba7c0ad235a625a (patch) | |
tree | ea80ba1bfb220de9a0aa55c60c7fac0cf8c13522 /test | |
parent | 4e821e64c7292ba635e55c409a015023d7549374 (diff) | |
download | ale-0ab689db0a137f7f62a3856eeba7c0ad235a625a.zip |
Allow warnings about trailing blank lines to be hidden for flake8 and pycodestyle
Diffstat (limited to 'test')
-rw-r--r-- | test/handler/test_flake8_handler.vader | 40 | ||||
-rw-r--r-- | test/handler/test_pycodestyle_handler.vader | 34 |
2 files changed, 71 insertions, 3 deletions
diff --git a/test/handler/test_flake8_handler.vader b/test/handler/test_flake8_handler.vader index d8cb51b3..655f02a3 100644 --- a/test/handler/test_flake8_handler.vader +++ b/test/handler/test_flake8_handler.vader @@ -1,8 +1,16 @@ Before: - runtime ale_linters/python/flake8.vim + Save g:ale_warn_about_trailing_blank_lines + + let g:ale_warn_about_trailing_blank_lines = 1 + + runtime ale_linters/python/flake8.vim After: - call ale#linter#Reset() + Restore + + unlet! b:ale_warn_about_trailing_blank_lines + + call ale#linter#Reset() Execute(The flake8 handler should handle basic warnings and syntax errors): AssertEqual @@ -126,7 +134,7 @@ Execute(The flake8 handler should handle stack traces): \ 'ImportError: No module named parser', \ ]) -Execute (The flake8 handler should handle names with spaces): +Execute(The flake8 handler should handle names with spaces): AssertEqual \ [ \ { @@ -141,3 +149,29 @@ Execute (The flake8 handler should handle names with spaces): \ ale_linters#python#flake8#Handle(42, [ \ 'C:\something\with spaces.py:6:6: E111 indentation is not a multiple of four', \ ]) + +Execute(Warnings about trailing blank lines should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'code': 'W391', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'blank line at end of file', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(Disabling trailing blank line warnings should work): + let b:ale_warn_about_trailing_blank_lines = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) diff --git a/test/handler/test_pycodestyle_handler.vader b/test/handler/test_pycodestyle_handler.vader index 856f4295..cb92eb3b 100644 --- a/test/handler/test_pycodestyle_handler.vader +++ b/test/handler/test_pycodestyle_handler.vader @@ -1,7 +1,15 @@ Before: + Save g:ale_warn_about_trailing_blank_lines + + let g:ale_warn_about_trailing_blank_lines = 1 + runtime ale_linters/python/pycodestyle.vim After: + Restore + + unlet! b:ale_warn_about_trailing_blank_lines + call ale#linter#Reset() silent file something_else.py @@ -64,3 +72,29 @@ Execute(The pycodestyle handler should parse output): \ 'stdin:222:34: W602 deprecated form of raising exception', \ 'example.py:544:21: W601 .has_key() is deprecated, use ''in''', \ ]) + +Execute(Warnings about trailing blank lines should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'code': 'W391', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'blank line at end of file', + \ }, + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(Disabling trailing blank line warnings should work): + let b:ale_warn_about_trailing_blank_lines = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) |