From 1dc4b3e7833dbd49704f137743e85e7c4300e230 Mon Sep 17 00:00:00 2001 From: Jorenar Date: Thu, 4 Dec 2025 03:58:19 +0100 Subject: [PATCH] Fix npm-groovy-lint --- ale_linters/groovy/npmgroovylint.vim | 5 ++--- doc/ale-groovy.txt | 9 ++++++++- test/handler/test_npmgroovylint_handler.vader | 6 ++---- test/linter/test_npmgroovylint.vader | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ale_linters/groovy/npmgroovylint.vim b/ale_linters/groovy/npmgroovylint.vim index 4141bd2546..0935884b4f 100644 --- a/ale_linters/groovy/npmgroovylint.vim +++ b/ale_linters/groovy/npmgroovylint.vim @@ -2,7 +2,7 @@ " Description: Integration of npm-groovy-lint for Groovy files. call ale#Set('groovy_npmgroovylint_executable', 'npm-groovy-lint') -call ale#Set('groovy_npmgroovylint_options', '--loglevel warning') +call ale#Set('groovy_npmgroovylint_options', '--noserver') function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options') @@ -19,9 +19,8 @@ function! ale_linters#groovy#npmgroovylint#Handle(buffer, lines) abort for [l:filename, l:file] in items(get(l:json, 'files', {})) for l:error in get(l:file, 'errors', []) let l:output_line = { - \ 'filename': l:filename, \ 'lnum': l:error.line, - \ 'text': l:error.msg, + \ 'text': l:error.msg . ' [' . l:error.rule . ']', \ 'type': toupper(l:error.severity[0]), \} diff --git a/doc/ale-groovy.txt b/doc/ale-groovy.txt index bb8d45fd2f..161fb29925 100644 --- a/doc/ale-groovy.txt +++ b/doc/ale-groovy.txt @@ -28,10 +28,17 @@ g:ale_groovy_npmgroovylint_executable groovy_npmgroovylint_options g:ale_groovy_npmgroovylint_options Type: |String| - Default: `'--loglevel warning'` + Default: `'--noserver'` Additional npm-groovy-lint linter options. + To re-enable the server mode and make it close when Vim exits, + you can use the following in your vimrc: > + + let g:ale_groovy_npmgroovylint_options = '' + autocmd VimLeavePre * silent! !npm-groovy-lint --killserver & +< + *ale-options.groovy_npmgroovylint_fix_options* *g:ale_groovy_npmgroovylint_fix_options* *b:ale_groovy_npmgroovylint_fix_options* diff --git a/test/handler/test_npmgroovylint_handler.vader b/test/handler/test_npmgroovylint_handler.vader index e0dae6d255..c1d70aaf18 100644 --- a/test/handler/test_npmgroovylint_handler.vader +++ b/test/handler/test_npmgroovylint_handler.vader @@ -11,15 +11,13 @@ Execute(The npm-groovy-lint handler should parse JSON): \ 'col': 0, \ 'end_col': 1, \ 'end_lnum': 2, - \ 'filename': 'test2.groovy', \ 'lnum': 2, - \ 'text': 'Some error message', + \ 'text': 'Some error message [SomeOtherRule]', \ 'type': 'E', \ }, \ { - \ 'filename': 'test.groovy', \ 'lnum': 1, - \ 'text': 'Some warning message', + \ 'text': 'Some warning message [SomeRule]', \ 'type': 'W', \ }, \ ], diff --git a/test/linter/test_npmgroovylint.vader b/test/linter/test_npmgroovylint.vader index e87b209be2..75026d4c65 100644 --- a/test/linter/test_npmgroovylint.vader +++ b/test/linter/test_npmgroovylint.vader @@ -9,7 +9,7 @@ After: Execute(The default npm-groovy-lint command should be correct): AssertLinter 'npm-groovy-lint', - \ ale#Escape('npm-groovy-lint') . ' --failon none --output json --loglevel warning %t' + \ ale#Escape('npm-groovy-lint') . ' --failon none --output json --noserver %t' Execute(Default options should be configurable): let b:ale_groovy_npmgroovylint_options = '--loglevel info'