From cf538c3a58d61cfe1a77d79455efb9175479fba3 Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 15 Nov 2017 17:35:34 +0000 Subject: #852 Capture error codes for pylint, throw away the msgid values --- test/handler/test_pylint_handler.vader | 50 +++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/handler/test_pylint_handler.vader b/test/handler/test_pylint_handler.vader index 2314e9b2..aff40845 100644 --- a/test/handler/test_pylint_handler.vader +++ b/test/handler/test_pylint_handler.vader @@ -1,47 +1,60 @@ Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + runtime ale_linters/python/pylint.vim After: + Restore + call ale#linter#Reset() + silent file something_else.py -Execute(pylint handler parsing, translating columns to 1-based index): +Execute(Basic pylint errors should be handle): AssertEqual \ [ \ { \ 'lnum': 4, \ 'col': 1, - \ 'text': 'C0303: Trailing whitespace (trailing-whitespace)', + \ 'text': 'Trailing whitespace', + \ 'code': 'trailing-whitespace', \ 'type': 'W', \ }, \ { \ 'lnum': 1, \ 'col': 1, - \ 'text': 'C0111: Missing module docstring (missing-docstring)', + \ 'text': 'Missing module docstring', + \ 'code': 'missing-docstring', \ 'type': 'W', \ }, \ { \ 'lnum': 2, \ 'col': 1, - \ 'text': 'C0111: Missing function docstring (missing-docstring)', + \ 'text': 'Missing function docstring', + \ 'code': 'missing-docstring', \ 'type': 'W', \ }, \ { \ 'lnum': 3, \ 'col': 5, - \ 'text': 'E0103: ''break'' not properly in loop (not-in-loop)', + \ 'text': '''break'' not properly in loop', + \ 'code': 'not-in-loop', \ 'type': 'E', \ }, \ { \ 'lnum': 4, \ 'col': 5, - \ 'text': 'W0101: Unreachable code (unreachable)', + \ 'text': 'Unreachable code', + \ 'code': 'unreachable', \ 'type': 'W', \ }, \ { \ 'lnum': 7, \ 'col': 33, - \ 'text': 'W0702: No exception type(s) specified (bare-except)', + \ 'text': 'No exception type(s) specified', + \ 'code': 'bare-except', \ 'type': 'W', \ }, \ ], @@ -58,3 +71,26 @@ Execute(pylint handler parsing, translating columns to 1-based index): \ '------------------------------------------------------------------', \ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)', \ ]) + +Execute(Ignoring trailing whitespace messages should work): + let g:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Missing module docstring', + \ 'code': 'missing-docstring', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#python#pylint#Handle(bufnr(''), [ + \ 'No config file found, using default configuration', + \ '************* Module test', + \ 'test.py:4:0: C0303 (trailing-whitespace) Trailing whitespace', + \ 'test.py:1:0: C0111 (missing-docstring) Missing module docstring', + \ '', + \ '------------------------------------------------------------------', + \ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)', + \ ]) -- cgit v1.2.3