2017-05-24 23:40:06 -04:00
|
|
|
Before:
|
2017-11-15 12:35:34 -05:00
|
|
|
Save g:ale_warn_about_trailing_whitespace
|
|
|
|
|
|
|
|
let g:ale_warn_about_trailing_whitespace = 1
|
|
|
|
|
2017-05-24 23:40:06 -04:00
|
|
|
runtime ale_linters/python/pylint.vim
|
|
|
|
|
|
|
|
After:
|
2017-11-15 12:35:34 -05:00
|
|
|
Restore
|
|
|
|
|
2017-05-24 23:40:06 -04:00
|
|
|
call ale#linter#Reset()
|
2017-11-15 12:35:34 -05:00
|
|
|
|
2017-05-24 23:40:06 -04:00
|
|
|
silent file something_else.py
|
|
|
|
|
2017-11-15 12:35:34 -05:00
|
|
|
Execute(Basic pylint errors should be handle):
|
2017-05-24 23:40:06 -04:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 1,
|
2017-11-15 12:35:34 -05:00
|
|
|
\ 'text': 'Trailing whitespace',
|
|
|
|
\ 'code': 'trailing-whitespace',
|
2017-05-24 23:40:06 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 1,
|
2017-11-15 12:35:34 -05:00
|
|
|
\ 'text': 'Missing module docstring',
|
|
|
|
\ 'code': 'missing-docstring',
|
2017-05-24 23:40:06 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 2,
|
|
|
|
\ 'col': 1,
|
2017-11-15 12:35:34 -05:00
|
|
|
\ 'text': 'Missing function docstring',
|
|
|
|
\ 'code': 'missing-docstring',
|
2017-05-24 23:40:06 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 3,
|
|
|
|
\ 'col': 5,
|
2017-11-15 12:35:34 -05:00
|
|
|
\ 'text': '''break'' not properly in loop',
|
|
|
|
\ 'code': 'not-in-loop',
|
2017-05-24 23:40:06 -04:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 5,
|
2017-11-15 12:35:34 -05:00
|
|
|
\ 'text': 'Unreachable code',
|
|
|
|
\ 'code': 'unreachable',
|
2017-05-24 23:40:06 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
2017-06-25 20:19:39 -04:00
|
|
|
\ {
|
|
|
|
\ 'lnum': 7,
|
|
|
|
\ 'col': 33,
|
2017-11-15 12:35:34 -05:00
|
|
|
\ 'text': 'No exception type(s) specified',
|
|
|
|
\ 'code': 'bare-except',
|
2017-06-25 20:19:39 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
2017-05-24 23:40:06 -04:00
|
|
|
\ ],
|
|
|
|
\ 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',
|
|
|
|
\ 'test.py:2:0: C0111 (missing-docstring) Missing function docstring',
|
|
|
|
\ 'test.py:3:4: E0103 (not-in-loop) ''break'' not properly in loop',
|
|
|
|
\ 'test.py:4:4: W0101 (unreachable) Unreachable code',
|
2017-06-25 20:19:39 -04:00
|
|
|
\ 'test.py:7:32: W0702 (bare-except) No exception type(s) specified',
|
2017-05-24 23:40:06 -04:00
|
|
|
\ '',
|
|
|
|
\ '------------------------------------------------------------------',
|
|
|
|
\ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)',
|
|
|
|
\ ])
|
2017-11-15 12:35:34 -05:00
|
|
|
|
|
|
|
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)',
|
|
|
|
\ ])
|
2018-04-10 10:18:16 -04:00
|
|
|
|
|
|
|
Execute(The pylint handler should parse Windows filenames):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 13,
|
|
|
|
\ 'col': 6,
|
|
|
|
\ 'text': 'Undefined variable ''x''',
|
|
|
|
\ 'code': 'undefined-variable',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#python#pylint#Handle(bufnr(''), [
|
|
|
|
\ '************* Module test',
|
|
|
|
\ 'D:\acm\github\vim\tools\test.py:13:5: E0602 (undefined-variable) Undefined variable ''x''',
|
|
|
|
\ '',
|
|
|
|
\ '------------------------------------------------------------------',
|
|
|
|
\ 'Your code has been rated at 5.83/10 (previous run: 5.83/10, +0.00)',
|
|
|
|
\ ])
|
2019-05-09 12:28:18 -04:00
|
|
|
|
|
|
|
Execute(Use msg_id):
|
|
|
|
let g:ale_python_pylint_use_msg_id = 1
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 13,
|
|
|
|
\ 'col': 6,
|
|
|
|
\ 'text': 'Undefined variable ''x''',
|
|
|
|
\ 'code': 'E0602',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#python#pylint#Handle(bufnr(''), [
|
|
|
|
\ '************* Module test',
|
|
|
|
\ 'D:\acm\github\vim\tools\test.py:13:5: E0602 (undefined-variable) Undefined variable ''x''',
|
|
|
|
\ '',
|
|
|
|
\ '------------------------------------------------------------------',
|
|
|
|
\ 'Your code has been rated at 5.83/10 (previous run: 5.83/10, +0.00)',
|
|
|
|
\ ])
|