summaryrefslogtreecommitdiff
path: root/ale_linters/scala
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-15 18:24:53 +0100
committerw0rp <devw0rp@gmail.com>2018-07-15 18:28:28 +0100
commita42999a639b2916b769a85f37d037be314d9d61b (patch)
tree5ebfb4d357dc673efa93fd32a66b489c4510de40 /ale_linters/scala
parent5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff)
downloadale-a42999a639b2916b769a85f37d037be314d9d61b.zip
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'ale_linters/scala')
-rw-r--r--ale_linters/scala/scalastyle.vim28
1 files changed, 9 insertions, 19 deletions
diff --git a/ale_linters/scala/scalastyle.vim b/ale_linters/scala/scalastyle.vim
index f78fd749..3232d70b 100644
--- a/ale_linters/scala/scalastyle.vim
+++ b/ale_linters/scala/scalastyle.vim
@@ -1,11 +1,11 @@
" Author: Kevin Kays - https://github.com/okkays
" Description: Support for the scalastyle checker.
-let g:ale_scala_scalastyle_options =
-\ get(g:, 'ale_scala_scalastyle_options', '')
-
-let g:ale_scalastyle_config_loc =
+call ale#Set('scala_scalastyle_options', '')
+" TODO: Remove support for the old option name in ALE 3.0.
+call ale#Set('scala_scalastyle_config',
\ get(g:, 'ale_scalastyle_config_loc', '')
+\)
function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort
" Look for help output from scalastyle first, which indicates that no
@@ -66,23 +66,13 @@ function! ale_linters#scala#scalastyle#GetCommand(buffer) abort
" If all else fails, try the global config.
if empty(l:scalastyle_config)
- let l:scalastyle_config = get(g:, 'ale_scalastyle_config_loc', '')
- endif
-
- " Build the command using the config file and additional options.
- let l:command = 'scalastyle'
-
- if !empty(l:scalastyle_config)
- let l:command .= ' --config ' . ale#Escape(l:scalastyle_config)
+ let l:scalastyle_config = ale#Var(a:buffer, 'scala_scalastyle_config')
endif
- if !empty(g:ale_scala_scalastyle_options)
- let l:command .= ' ' . g:ale_scala_scalastyle_options
- endif
-
- let l:command .= ' %t'
-
- return l:command
+ return 'scalastyle'
+ \ . (!empty(l:scalastyle_config) ? ' --config ' . ale#Escape(l:scalastyle_config) : '')
+ \ . ale#Pad(ale#Var(a:buffer, 'scala_scalastyle_options'))
+ \ . ' %t'
endfunction
call ale#linter#Define('scala', {