From a42999a639b2916b769a85f37d037be314d9d61b Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 15 Jul 2018 18:24:53 +0100 Subject: Massively reduce the amount of code needed for linter tests --- ale_linters/scala/scalastyle.vim | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'ale_linters/scala/scalastyle.vim') 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', { -- cgit v1.2.3