]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/handler/test_pylint_handler.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / handler / test_pylint_handler.vader
1 Before:
2   Save g:ale_warn_about_trailing_whitespace
3
4   let g:ale_warn_about_trailing_whitespace = 1
5
6   runtime ale_linters/python/pylint.vim
7
8 After:
9   Restore
10
11   call ale#linter#Reset()
12
13   silent file something_else.py
14
15 Execute(Basic pylint errors should be handle):
16   AssertEqual
17   \ [
18   \   {
19   \     'lnum': 4,
20   \     'col': 1,
21   \     'text': 'Trailing whitespace',
22   \     'code': 'trailing-whitespace',
23   \     'type': 'W',
24   \   },
25   \   {
26   \     'lnum': 1,
27   \     'col': 1,
28   \     'text': 'Missing module docstring',
29   \     'code': 'missing-docstring',
30   \     'type': 'W',
31   \   },
32   \   {
33   \     'lnum': 2,
34   \     'col': 1,
35   \     'text': 'Missing function docstring',
36   \     'code': 'missing-docstring',
37   \     'type': 'W',
38   \   },
39   \   {
40   \     'lnum': 3,
41   \     'col': 5,
42   \     'text': '''break'' not properly in loop',
43   \     'code': 'not-in-loop',
44   \     'type': 'E',
45   \   },
46   \   {
47   \     'lnum': 4,
48   \     'col': 5,
49   \     'text': 'Unreachable code',
50   \     'code': 'unreachable',
51   \     'type': 'W',
52   \   },
53   \   {
54   \     'lnum': 7,
55   \     'col': 33,
56   \     'text': 'No exception type(s) specified',
57   \     'code': 'bare-except',
58   \     'type': 'W',
59   \   },
60   \ ],
61   \ ale_linters#python#pylint#Handle(bufnr(''), [
62   \ 'No config file found, using default configuration',
63   \ '************* Module test',
64   \ 'test.py:4:0: C0303 (trailing-whitespace) Trailing whitespace',
65   \ 'test.py:1:0: C0111 (missing-docstring) Missing module docstring',
66   \ 'test.py:2:0: C0111 (missing-docstring) Missing function docstring',
67   \ 'test.py:3:4: E0103 (not-in-loop) ''break'' not properly in loop',
68   \ 'test.py:4:4: W0101 (unreachable) Unreachable code',
69   \ 'test.py:7:32: W0702 (bare-except) No exception type(s) specified',
70   \ '',
71   \ '------------------------------------------------------------------',
72   \ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)',
73   \ ])
74
75 Execute(Ignoring trailing whitespace messages should work):
76   let g:ale_warn_about_trailing_whitespace = 0
77
78   AssertEqual
79   \ [
80   \   {
81   \     'lnum': 1,
82   \     'col': 1,
83   \     'text': 'Missing module docstring',
84   \     'code': 'missing-docstring',
85   \     'type': 'W',
86   \   },
87   \ ],
88   \ ale_linters#python#pylint#Handle(bufnr(''), [
89   \ 'No config file found, using default configuration',
90   \ '************* Module test',
91   \ 'test.py:4:0: C0303 (trailing-whitespace) Trailing whitespace',
92   \ 'test.py:1:0: C0111 (missing-docstring) Missing module docstring',
93   \ '',
94   \ '------------------------------------------------------------------',
95   \ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)',
96   \ ])
97
98 Execute(The pylint handler should parse Windows filenames):
99   AssertEqual
100   \ [
101   \   {
102   \     'lnum': 13,
103   \     'col': 6,
104   \     'text': 'Undefined variable ''x''',
105   \     'code': 'undefined-variable',
106   \     'type': 'E',
107   \   },
108   \ ],
109   \ ale_linters#python#pylint#Handle(bufnr(''), [
110   \   '************* Module test',
111   \   'D:\acm\github\vim\tools\test.py:13:5: E0602 (undefined-variable) Undefined variable ''x''',
112   \   '',
113   \   '------------------------------------------------------------------',
114   \   'Your code has been rated at 5.83/10 (previous run: 5.83/10, +0.00)',
115   \ ])
116
117 Execute(Use msg_id):
118   let g:ale_python_pylint_use_msg_id = 1
119   AssertEqual
120   \ [
121   \   {
122   \     'lnum': 13,
123   \     'col': 6,
124   \     'text': 'Undefined variable ''x''',
125   \     'code': 'E0602',
126   \     'type': 'E',
127   \   },
128   \ ],
129   \ ale_linters#python#pylint#Handle(bufnr(''), [
130   \   '************* Module test',
131   \   'D:\acm\github\vim\tools\test.py:13:5: E0602 (undefined-variable) Undefined variable ''x''',
132   \   '',
133   \   '------------------------------------------------------------------',
134   \   'Your code has been rated at 5.83/10 (previous run: 5.83/10, +0.00)',
135   \ ])