/ test / handler / test_ruff_handler.vader
test_ruff_handler.vader
 1  Before:
 2    runtime ale_linters/python/ruff.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute(We should handle basic output of ruff correctly):
 8    AssertEqual
 9    \ [
10    \   {
11    \     'lnum': 2,
12    \     'col': 1,
13    \     'code': 'F821',
14    \     'type': 'W',
15    \     'end_col': 7,
16    \     'end_lnum': 2,
17    \     'text': 'Undefined name example',
18    \   },
19    \ ],
20    \ ale_linters#python#ruff#Handle(bufnr(''), [
21    \   '{"cell":null,"code":"F821","end_location":{"column":8,"row":2},"filename":"/home/eduardo/Code/Python/test.py","fix":null,"location":{"column":1,"row":2},"message":"Undefined name example","noqa_row":2,"url":"https://docs.astral.sh/ruff/rules/undefined-name"}',
22    \ ])
23  
24  Execute(We should handle totally broken output from ruff):
25    AssertEqual [], ale_linters#python#ruff#Handle(bufnr(''), ['ERROR: oh noes!'])
26  
27  Execute(We should handle mixed error lines and JSON output from ruff):
28    AssertEqual
29    \ [
30    \   {
31    \     'lnum': 2,
32    \     'col': 1,
33    \     'code': 'F821',
34    \     'type': 'W',
35    \     'end_col': 7,
36    \     'end_lnum': 2,
37    \     'text': 'Undefined name example',
38    \   },
39    \ ],
40    \ ale_linters#python#ruff#Handle(bufnr(''), [
41    \   'ERROR: oh noes!',
42    \   '{"cell":null,"code":"F821","end_location":{"column":8,"row":2},"filename":"/home/eduardo/Code/Python/test.py","fix":null,"location":{"column":1,"row":2},"message":"Undefined name example","noqa_row":2,"url":"https://docs.astral.sh/ruff/rules/undefined-name"}',
43    \ ])