summaryrefslogtreecommitdiff
path: root/test/linter/test_yaml_actionlint.vader
blob: d9970cf503d6ce56c3b3e55139e86820c2500f05 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Before:
  call ale#assert#SetUpLinterTest('yaml', 'actionlint')

After:
  call ale#assert#TearDownLinterTest()

Execute(Problems should be parsed correctly for actionlint):
  AssertEqual
  \ [
  \   {
  \     'lnum': 2,
  \     'col': 1,
  \     'type': 'E',
  \     'text': '"jobs" section is missing in workflow',
  \     'code': 'syntax-check',
  \   },
  \   {
  \     'lnum': 56,
  \     'col': 23,
  \     'type': 'E',
  \     'text': 'property "unknown_input" is not defined in object type {input7: bool; input0: any; input1: any; input2: string; input3: any; input4: any; input5: number; input6: number}',
  \     'code': 'expression',
  \   },
  \ ],
  \ ale_linters#yaml#actionlint#Handle(bufnr(''), [
  \   '.codecov.yaml:2:1: "jobs" section is missing in workflow [syntax-check]',
  \   'workflow_call_event.yaml:56:23: property "unknown_input" is not defined in object type {input7: bool; input0: any; input1: any; input2: string; input3: any; input4: any; input5: number; input6: number} [expression]',
  \ ])

Execute(Shellcheck issues should be reported at the line they appear):
  AssertEqual
  \ [
  \   {
  \     'lnum': 19,
  \     'col': 9,
  \     'type': 'E',
  \     'text': 'Double quote to prevent globbing and word splitting',
  \     'code': 'shellcheck SC2086',
  \   },
  \ ],
  \ ale_linters#yaml#actionlint#Handle(bufnr(''), [
  \   'validate.yml:19:9: shellcheck reported issue in this script: SC2086:info:1:15: Double quote to prevent globbing and word splitting [shellcheck]'
  \ ])

Execute(Command should always have -no-color, -oneline and - options):
  let g:ale_yaml_actionlint_options = ''

  AssertEqual
  \   '%e  -no-color -oneline - ',
  \ ale_linters#yaml#actionlint#GetCommand(bufnr(''))

Execute(Options should be added to command):
  let g:ale_yaml_actionlint_options = '-shellcheck= -pyflakes='

  AssertEqual
  \   '%e -shellcheck= -pyflakes= -no-color -oneline - ',
  \ ale_linters#yaml#actionlint#GetCommand(bufnr(''))