summaryrefslogtreecommitdiff
path: root/ale_linters/perl
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/perl')
-rw-r--r--ale_linters/perl/perl.vim17
-rw-r--r--ale_linters/perl/perlcritic.vim25
2 files changed, 11 insertions, 31 deletions
diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim
index 1b9aa95e..d1dcbc9c 100644
--- a/ale_linters/perl/perl.vim
+++ b/ale_linters/perl/perl.vim
@@ -1,20 +1,11 @@
" Author: Vincent Lequertier <https://github.com/SkySymbol>
" Description: This file adds support for checking perl syntax
-let g:ale_perl_perl_executable =
-\ get(g:, 'ale_perl_perl_executable', 'perl')
-
-let g:ale_perl_perl_options =
-\ get(g:, 'ale_perl_perl_options', '-c -Mwarnings -Ilib')
-
-function! ale_linters#perl#perl#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'perl_perl_executable')
-endfunction
+call ale#Set('perl_perl_executable', 'perl')
+call ale#Set('perl_perl_options', '-c -Mwarnings -Ilib')
function! ale_linters#perl#perl#GetCommand(buffer) abort
- return ale#Escape(ale_linters#perl#perl#GetExecutable(a:buffer))
- \ . ' ' . ale#Var(a:buffer, 'perl_perl_options')
- \ . ' %t'
+ return '%e' . ale#Pad(ale#Var(a:buffer, 'perl_perl_options')) . ' %t'
endfunction
let s:begin_failed_skip_pattern = '\v' . join([
@@ -61,7 +52,7 @@ endfunction
call ale#linter#Define('perl', {
\ 'name': 'perl',
-\ 'executable_callback': 'ale_linters#perl#perl#GetExecutable',
+\ 'executable_callback': ale#VarFunc('perl_perl_executable'),
\ 'output_stream': 'both',
\ 'command_callback': 'ale_linters#perl#perl#GetCommand',
\ 'callback': 'ale_linters#perl#perl#Handle',
diff --git a/ale_linters/perl/perlcritic.vim b/ale_linters/perl/perlcritic.vim
index e91c8a03..8619a404 100644
--- a/ale_linters/perl/perlcritic.vim
+++ b/ale_linters/perl/perlcritic.vim
@@ -1,21 +1,10 @@
" Author: Vincent Lequertier <https://github.com/SkySymbol>, Chris Weyl <cweyl@alumni.drew.edu>
" Description: This file adds support for checking perl with perl critic
-let g:ale_perl_perlcritic_executable =
-\ get(g:, 'ale_perl_perlcritic_executable', 'perlcritic')
-
-let g:ale_perl_perlcritic_profile =
-\ get(g:, 'ale_perl_perlcritic_profile', '.perlcriticrc')
-
-let g:ale_perl_perlcritic_options =
-\ get(g:, 'ale_perl_perlcritic_options', '')
-
-let g:ale_perl_perlcritic_showrules =
-\ get(g:, 'ale_perl_perlcritic_showrules', 0)
-
-function! ale_linters#perl#perlcritic#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'perl_perlcritic_executable')
-endfunction
+call ale#Set('perl_perlcritic_executable', 'perlcritic')
+call ale#Set('perl_perlcritic_profile', '.perlcriticrc')
+call ale#Set('perl_perlcritic_options', '')
+call ale#Set('perl_perlcritic_showrules', 0)
function! ale_linters#perl#perlcritic#GetProfile(buffer) abort
" first see if we've been overridden
@@ -39,11 +28,11 @@ function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer)
let l:options = ale#Var(a:buffer, 'perl_perlcritic_options')
- return ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer))
+ return '%e'
\ . ' --verbose ' . ale#Escape(l:critic_verbosity)
\ . ' --nocolor'
\ . (!empty(l:profile) ? ' --profile ' . ale#Escape(l:profile) : '')
- \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ale#Pad(l:options)
endfunction
@@ -66,7 +55,7 @@ endfunction
call ale#linter#Define('perl', {
\ 'name': 'perlcritic',
\ 'output_stream': 'stdout',
-\ 'executable_callback': 'ale_linters#perl#perlcritic#GetExecutable',
+\ 'executable_callback': ale#VarFunc('perl_perlcritic_executable'),
\ 'command_callback': 'ale_linters#perl#perlcritic#GetCommand',
\ 'callback': 'ale_linters#perl#perlcritic#Handle',
\})