]> git.madduck.net Git - etc/vim.git/blob - test/linter/test_golangci_lint.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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / linter / test_golangci_lint.vader
1 Before:
2   Save g:ale_go_go111module
3
4   call ale#assert#SetUpLinterTest('go', 'golangci_lint')
5   call ale#test#SetFilename('test.go')
6
7   " Test with version 1.64.8 by default
8   GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
9
10 After:
11   Restore
12
13   unlet! b:ale_go_go111module
14
15   call ale#assert#TearDownLinterTest()
16
17 Execute(The golangci-lint defaults should be correct):
18   AssertLinterCwd '%s:h',
19   AssertLinter 'golangci-lint',
20   \ ale#Escape('golangci-lint') . ' run  --out-format=json --show-stats=0'
21
22 Execute(The golangci-lint defaults should be correct with no version info):
23   GivenCommandOutput []
24   AssertLinterCwd '%s:h',
25   AssertLinter 'golangci-lint',
26   \ ale#Escape('golangci-lint') . ' run  --out-format=json --show-stats=0'
27
28 Execute(The golangci-lint defaults should be correct with version 2):
29   GivenCommandOutput ['golangci-lint has version 2.0.2 built with go1.24.0']
30   AssertLinterCwd '%s:h',
31   AssertLinter 'golangci-lint',
32   \ ale#Escape('golangci-lint') . ' run  --output.json.path stdout --output.text.path stderr --show-stats=0'
33
34 Execute(The golangci-lint callback should use a configured executable):
35   let b:ale_go_golangci_lint_executable = 'something else'
36
37   AssertLinter 'something else',
38   \ ale#Escape('something else')
39   \   . ' run  --out-format=json --show-stats=0'
40
41 Execute(The golangci-lint callback should use a configured version 2 executable):
42   GivenCommandOutput ['golangci-lint has version 2.0.0 built with go1.22.0']
43   let b:ale_go_golangci_lint_executable = 'something else'
44
45   AssertLinter 'something else',
46   \ ale#Escape('something else')
47   \   . ' run  --output.json.path stdout --output.text.path stderr --show-stats=0'
48
49 Execute(The golangci-lint callback should use configured options):
50   let b:ale_go_golangci_lint_options = '--foobar'
51
52   AssertLinter 'golangci-lint',
53   \ ale#Escape('golangci-lint')
54   \   . ' run '
55   \   . '--foobar '
56   \   . '--out-format=json '
57   \   . '--show-stats=0'
58
59 Execute(The golangci-lint callback should support environment variables):
60   let b:ale_go_go111module = 'on'
61
62   AssertLinter 'golangci-lint',
63   \ ale#Env('GO111MODULE', 'on')
64   \   . ale#Escape('golangci-lint')
65   \   . ' run  '
66   \   . '--out-format=json '
67   \   . '--show-stats=0'
68
69 Execute(The golangci-lint `lint_package` option should use the correct command):
70   let b:ale_go_golangci_lint_package = 0
71   AssertLinter 'golangci-lint',
72   \ ale#Escape('golangci-lint')
73   \   . ' run ' . ale#Escape(expand('%' . ':t'))
74   \   . '  --out-format=json --show-stats=0'