Files
ale/test/fixers/test_golangci_lint_fixer_callback.vader
Horacio Sanson 5098dfd27e
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Fix golangci-lint fixer with version 2 (#4960)
2025-05-17 20:28:17 +09:00

81 lines
2.4 KiB
Plaintext

Before:
call ale#assert#SetUpFixerTest('go', 'golangci_lint')
Save g:ale_go_go111module
Save g:ale_go_golangci_formatter_executable
Save g:ale_go_golangci_formatter_options
call ale#test#SetDirectory('/testplugin/test/fixers')
call ale#test#SetFilename('../test-files/go/testfile.go')
After:
call ale#test#RestoreDirectory()
call ale#assert#TearDownFixerTest()
unlet! b:ale_go_go111module
Execute(The golangci-lint callback should return the correct default values with v1):
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint') . ' run --fix ' . ale#Escape('testfile.go'),
\ }
Execute(The golangci-lint callback should include custom golangci-lint options with v1):
let g:ale_go_golangci_formatter_options = "--new --config /dev/null"
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint')
\ . ' run --fix ' . g:ale_go_golangci_formatter_options . ' ' . ale#Escape('testfile.go'),
\ },
Execute(The golangci-lint callback should override executable with v1):
let g:ale_go_golangci_formatter_executable = 'xxxinvalid'
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' run --fix '
\ . g:ale_go_golangci_formatter_options
\ . ' ' . ale#Escape('testfile.go'),
\ },
Execute(The golangci-lint callback should return the correct default values with v2):
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint') . ' fmt --stdin ',
\ }
Execute(The golangci-lint callback should include custom golangci-lint options with v2):
let g:ale_go_golangci_formatter_options = "--new --config /dev/null"
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint')
\ . ' fmt --stdin ' . g:ale_go_golangci_formatter_options,
\ },
Execute(The golangci-lint callback should override executable with v2):
let g:ale_go_golangci_formatter_executable = 'xxxinvalid'
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' fmt --stdin '
\ . g:ale_go_golangci_formatter_options
\ },