Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ale_linters/groovy/npmgroovylint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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]),
\}

Expand Down
9 changes: 8 additions & 1 deletion doc/ale-groovy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
6 changes: 2 additions & 4 deletions test/handler/test_npmgroovylint_handler.vader
Original file line number Diff line number Diff line change
Expand Up @@ -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',
\ },
\ ],
Expand Down
2 changes: 1 addition & 1 deletion test/linter/test_npmgroovylint.vader
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down