]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/fixers/golangci_lint.vim

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] / autoload / ale / fixers / golangci_lint.vim
1 " Author: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
2 " Description: Run golangci-lint with the --fix flag to autofix some issues
3
4 call ale#Set('go_golangci_lint_options', '')
5 call ale#Set('go_golangci_lint_executable', 'golangci-lint')
6 call ale#Set('go_golangci_lint_package', 1)
7
8 function! ale#fixers#golangci_lint#GetCommand(buffer) abort
9     let l:filename = expand('#' . a:buffer . ':t')
10     let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable')
11     let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') . ' --fix'
12     let l:package_mode = ale#Var(a:buffer, 'go_golangci_lint_package')
13     let l:env = ale#go#EnvString(a:buffer)
14
15
16     if l:package_mode
17         return l:env . ale#Escape(l:executable)
18         \   . ' run '
19         \   .  l:options
20     endif
21
22     return l:env . ale#Escape(l:executable)
23     \   . ' run '
24     \   . l:options
25     \   . ' ' . ale#Escape(l:filename)
26 endfunction
27
28 function! ale#fixers#golangci_lint#Fix(buffer) abort
29     return {
30     \  'command': ale#fixers#golangci_lint#GetCommand(a:buffer),
31     \}
32 endfunction