mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Add golangci-lint fixer (#4853)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-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
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-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
Closes #4616
This commit is contained in:
committed by
GitHub
parent
0ef2c455ee
commit
65b49c1b81
48
test/fixers/test_golangci_lint_fixer_callback.vader
Normal file
48
test/fixers/test_golangci_lint_fixer_callback.vader
Normal file
@@ -0,0 +1,48 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
Save g:ale_go_golangci_lint_executable
|
||||
Save g:ale_go_golangci_lint_options
|
||||
Save g:ale_go_golangci_lint_package
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_go_golangci_lint_executable = 'xxxinvalid'
|
||||
let g:ale_go_golangci_lint_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
call ale#test#SetFilename('../test-files/go/testfile.go')
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The golangci-lint callback should return the correct default values):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid') . ' run --fix',
|
||||
\ },
|
||||
\ ale#fixers#golangci_lint#Fix(bufnr(''))
|
||||
|
||||
Execute(The golangci-lint callback should include custom golangci-lint options):
|
||||
let g:ale_go_golangci_lint_options = "--new --config /dev/null"
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' run ' . g:ale_go_golangci_lint_options . ' --fix',
|
||||
\ },
|
||||
\ ale#fixers#golangci_lint#Fix(bufnr(''))
|
||||
|
||||
Execute(The golangci-lint callback should support per-file mode):
|
||||
let g:ale_go_golangci_lint_package = 0
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' run '
|
||||
\ . g:ale_go_golangci_lint_options
|
||||
\ . ' --fix ' . ale#Escape('testfile.go'),
|
||||
\ },
|
||||
\ ale#fixers#golangci_lint#Fix(bufnr(''))
|
||||
Reference in New Issue
Block a user