summaryrefslogtreecommitdiff
path: root/ale_linters/java
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-06-16 18:13:47 +0100
committerGitHub <noreply@github.com>2019-06-16 18:13:47 +0100
commit15f23532b78d1d82c795fbd38a53bd5026f88ae4 (patch)
treec4e5ad4ee4ac56efd5289ab417e30bce1b3c3ca8 /ale_linters/java
parent3acfa0813e9c5edfa1d2a8099e86f39623d86251 (diff)
parenteb6a7b75164ae2a0acb87fc9a7402779dc3e3614 (diff)
downloadale-15f23532b78d1d82c795fbd38a53bd5026f88ae4.zip
Merge pull request #2577 from hsanson/fix-checkstyle-defaults
Fix checkstyle default configuration.
Diffstat (limited to 'ale_linters/java')
-rw-r--r--ale_linters/java/checkstyle.vim14
1 files changed, 12 insertions, 2 deletions
diff --git a/ale_linters/java/checkstyle.vim b/ale_linters/java/checkstyle.vim
index ee3ca7a3..7901ff7e 100644
--- a/ale_linters/java/checkstyle.vim
+++ b/ale_linters/java/checkstyle.vim
@@ -2,7 +2,7 @@
" Description: checkstyle for Java files
call ale#Set('java_checkstyle_executable', 'checkstyle')
-call ale#Set('java_checkstyle_config', 'google_checks.xml')
+call ale#Set('java_checkstyle_config', '/google_checks.xml')
call ale#Set('java_checkstyle_options', '')
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
@@ -39,11 +39,21 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
return l:output
endfunction
+function! s:GetConfig(buffer, config) abort
+ if ale#path#IsAbsolute(a:config)
+ return a:config
+ endif
+
+ let s:file = ale#path#FindNearestFile(a:buffer, a:config)
+
+ return !empty(s:file) ? s:file : a:config
+endfunction
+
function! ale_linters#java#checkstyle#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'java_checkstyle_options')
let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config')
let l:config = l:options !~# '\v(^| )-c' && !empty(l:config_option)
- \ ? ale#path#FindNearestFile(a:buffer, l:config_option)
+ \ ? s:GetConfig(a:buffer, l:config_option)
\ : ''
return '%e'