Skip to content

Commit 1dc4b3e

Browse files
committed
Fix npm-groovy-lint
1 parent ca1da76 commit 1dc4b3e

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

ale_linters/groovy/npmgroovylint.vim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Description: Integration of npm-groovy-lint for Groovy files.
33

44
call ale#Set('groovy_npmgroovylint_executable', 'npm-groovy-lint')
5-
call ale#Set('groovy_npmgroovylint_options', '--loglevel warning')
5+
call ale#Set('groovy_npmgroovylint_options', '--noserver')
66

77
function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
88
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
@@ -19,9 +19,8 @@ function! ale_linters#groovy#npmgroovylint#Handle(buffer, lines) abort
1919
for [l:filename, l:file] in items(get(l:json, 'files', {}))
2020
for l:error in get(l:file, 'errors', [])
2121
let l:output_line = {
22-
\ 'filename': l:filename,
2322
\ 'lnum': l:error.line,
24-
\ 'text': l:error.msg,
23+
\ 'text': l:error.msg . ' [' . l:error.rule . ']',
2524
\ 'type': toupper(l:error.severity[0]),
2625
\}
2726

doc/ale-groovy.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,17 @@ g:ale_groovy_npmgroovylint_executable
2828
groovy_npmgroovylint_options
2929
g:ale_groovy_npmgroovylint_options
3030
Type: |String|
31-
Default: `'--loglevel warning'`
31+
Default: `'--noserver'`
3232

3333
Additional npm-groovy-lint linter options.
3434

35+
To re-enable the server mode and make it close when Vim exits,
36+
you can use the following in your vimrc: >
37+
38+
let g:ale_groovy_npmgroovylint_options = ''
39+
autocmd VimLeavePre * silent! !npm-groovy-lint --killserver &
40+
<
41+
3542
*ale-options.groovy_npmgroovylint_fix_options*
3643
*g:ale_groovy_npmgroovylint_fix_options*
3744
*b:ale_groovy_npmgroovylint_fix_options*

test/handler/test_npmgroovylint_handler.vader

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ Execute(The npm-groovy-lint handler should parse JSON):
1111
\ 'col': 0,
1212
\ 'end_col': 1,
1313
\ 'end_lnum': 2,
14-
\ 'filename': 'test2.groovy',
1514
\ 'lnum': 2,
16-
\ 'text': 'Some error message',
15+
\ 'text': 'Some error message [SomeOtherRule]',
1716
\ 'type': 'E',
1817
\ },
1918
\ {
20-
\ 'filename': 'test.groovy',
2119
\ 'lnum': 1,
22-
\ 'text': 'Some warning message',
20+
\ 'text': 'Some warning message [SomeRule]',
2321
\ 'type': 'W',
2422
\ },
2523
\ ],

test/linter/test_npmgroovylint.vader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ After:
99

1010
Execute(The default npm-groovy-lint command should be correct):
1111
AssertLinter 'npm-groovy-lint',
12-
\ ale#Escape('npm-groovy-lint') . ' --failon none --output json --loglevel warning %t'
12+
\ ale#Escape('npm-groovy-lint') . ' --failon none --output json --noserver %t'
1313

1414
Execute(Default options should be configurable):
1515
let b:ale_groovy_npmgroovylint_options = '--loglevel info'

0 commit comments

Comments
 (0)