File: test_sql_sqlfluff_handler.vader

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (83 lines) | stat: -rw-r--r-- 3,080 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Before:
  runtime ale_linters/sql/sqlfluff.vim

After:
  call ale#linter#Reset()

Execute(The sqlfluff handler should handle basic warnings with version older than 3.0.0):
  AssertEqual
  \ [
  \   {
  \     'filename': 'schema.sql',
  \     'lnum': 1,
  \     'col': 8,
  \     'type': 'W',
  \     'code': 'L010',
  \     'text': 'Keywords must be consistently upper case.',
  \   },
  \   {
  \     'filename': 'schema.sql',
  \     'lnum': 13,
  \     'col': 2,
  \     'type': 'W',
  \     'code': 'L003',
  \     'text': 'Expected 1 indentation, found 0 [compared to line 12]',
  \   },
  \   {
  \     'filename': 'schema.sql',
  \     'lnum': 16,
  \     'col': 1,
  \     'type': 'W',
  \     'code': 'L009',
  \     'text': 'Files must end with a single trailing newline.',
  \   },
  \ ],
  \ ale_linters#sql#sqlfluff#Handle(bufnr(''), [2, 3, 5], [
  \    '[{"filepath": "schema.sql", "violations": [{"line_no": 1, "line_pos": 8, "code": "L010", "description": "Keywords must be consistently upper case."}, {"line_no": 13, "line_pos": 2, "code": "L003", "description": "Expected 1 indentation, found 0 [compared to line 12]"}, {"line_no": 16, "line_pos": 1, "code": "L009", "description": "Files must end with a single trailing newline."}]}]',
  \ ])

Execute(The sqlfluff handler should handle basic warnings with version newer than 3.0.0):
  AssertEqual
  \ [
  \   {
  \     'filename': 'schema.sql',
  \     'lnum': 1,
  \     'end_lnum': 1,
  \     'col': 8,
  \     'end_col': 12,
  \     'type': 'W',
  \     'code': 'L010',
  \     'text': 'Keywords must be consistently upper case.',
  \   },
  \   {
  \     'filename': 'schema.sql',
  \     'lnum': 13,
  \     'end_lnum': 13,
  \     'col': 2,
  \     'end_col': 20,
  \     'type': 'W',
  \     'code': 'L003',
  \     'text': 'Expected 1 indentation, found 0 [compared to line 12]',
  \   },
  \   {
  \     'filename': 'schema.sql',
  \     'lnum': 16,
  \     'end_lnum': 16,
  \     'col': 1,
  \     'end_col': 5,
  \     'type': 'W',
  \     'code': 'L009',
  \     'text': 'Files must end with a single trailing newline.',
  \   },
  \   {
  \     'filename': 'schema.sql',
  \     'lnum': 3,
  \     'col': 21,
  \     'type': 'W',
  \     'code': 'TMP',
  \     'text': "Undefined jinja template variable: 'a_jinja_templated_table'",
  \   },
  \ ],
  \ ale_linters#sql#sqlfluff#Handle(bufnr(''), [3, 0, 0], [
  \    '[{"filepath": "schema.sql", "violations": [{"start_line_no": 1, "end_line_no":1, "start_line_pos": 8, "end_line_pos":12, "code": "L010", "description": "Keywords must be consistently upper case."}, {"start_line_no": 13, "end_line_no":13, "start_line_pos": 2, "end_line_pos":20, "code": "L003", "description": "Expected 1 indentation, found 0 [compared to line 12]"}, {"start_line_no": 16, "end_line_no":16, "start_line_pos": 1, "end_line_pos":5, "code": "L009", "description": "Files must end with a single trailing newline."}, {"start_line_no": 3, "start_line_pos": 21, "code": "TMP", "description": "Undefined jinja template variable: ''a_jinja_templated_table''"}]}]',
  \ ])