summaryrefslogtreecommitdiff
path: root/test/handler/test_ruff_handler.vader
blob: 8201270619887eb2b6a7b8d47c2e0b4ab12f5880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Before:
  runtime ale_linters/python/ruff.vim

After:
  call ale#linter#Reset()

Execute(We should handle basic output of ruff correctly):
  AssertEqual
  \ [
  \   {
  \     'lnum': 2,
  \     'col': 1,
  \     'code': 'F821',
  \     'type': 'W',
  \     'end_col': 7,
  \     'end_lnum': 2,
  \     'text': 'Undefined name example',
  \   },
  \ ],
  \ ale_linters#python#ruff#Handle(bufnr(''), [
  \   '{"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"}',
  \ ])

Execute(We should handle totally broken output from ruff):
  AssertEqual [], ale_linters#python#ruff#Handle(bufnr(''), ['ERROR: oh noes!'])

Execute(We should handle mixed error lines and JSON output from ruff):
  AssertEqual
  \ [
  \   {
  \     'lnum': 2,
  \     'col': 1,
  \     'code': 'F821',
  \     'type': 'W',
  \     'end_col': 7,
  \     'end_lnum': 2,
  \     'text': 'Undefined name example',
  \   },
  \ ],
  \ ale_linters#python#ruff#Handle(bufnr(''), [
  \   'ERROR: oh noes!',
  \   '{"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"}',
  \ ])