summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorlucas-str <32294068+lucas-str@users.noreply.github.com>2023-05-06 02:02:07 +0200
committerGitHub <noreply@github.com>2023-05-06 09:02:07 +0900
commit9fe9f115213d7e7bf52d06ebdc69c6df38b1120b (patch)
tree36afc7ede0bf275c71e4f043745d5e15b40860e0 /autoload
parent61248e1453dc6373160154e1f6855ffc510a7dfc (diff)
downloadale-9fe9f115213d7e7bf52d06ebdc69c6df38b1120b.zip
Add support for npm-groovy-lint (#4495)
* Add support for npm-groovy-lint * Add doc and tests for npm-groovy-lint * Use ale#util#FuzzyJSONDecode instead of json_decode
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/npmgroovylint.vim16
-rw-r--r--autoload/ale/linter.vim1
3 files changed, 22 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 66cdc707..2f7edba8 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -610,6 +610,11 @@ let s:default_registry = {
\ 'function': 'ale#fixers#rustywind#Fix',
\ 'suggested_filetypes': ['html'],
\ 'description': 'Sort Tailwind CSS classes',
+\ },
+\ 'npm-groovy-lint': {
+\ 'function': 'ale#fixers#npmgroovylint#Fix',
+\ 'suggested_filetypes': ['groovy'],
+\ 'description': 'Fix Groovy files with npm-groovy-fix.',
\ }
\}
diff --git a/autoload/ale/fixers/npmgroovylint.vim b/autoload/ale/fixers/npmgroovylint.vim
new file mode 100644
index 00000000..39e43cf6
--- /dev/null
+++ b/autoload/ale/fixers/npmgroovylint.vim
@@ -0,0 +1,16 @@
+" Author: lucas-str <lucas.sturelle@ik.me>
+" Description: Integration of npm-groovy-lint for Groovy files.
+
+call ale#Set('groovy_npmgroovylint_fix_options', '--fix')
+
+function! ale#fixers#npmgroovylint#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'groovy_npmgroovylint_executable')
+ let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_fix_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim
index d90deace..8b943ea0 100644
--- a/autoload/ale/linter.vim
+++ b/autoload/ale/linter.vim
@@ -43,6 +43,7 @@ let s:default_ale_linters = {
\ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golint', 'gopls', 'govet'],
+\ 'groovy': ['npm-groovy-lint'],
\ 'hack': ['hack'],
\ 'help': [],
\ 'inko': ['inko'],