summaryrefslogtreecommitdiff
path: root/ale_linters/perl
diff options
context:
space:
mode:
authorPaul Johnson <paul@pjcj.net>2017-02-26 14:50:43 +0100
committerw0rp <devw0rp@gmail.com>2017-03-11 14:53:30 +0000
commitc2ceb9e085c8dd849dee57bdd91b2500fa7b528f (patch)
treefa0844a3c36cc0af7d5e4914c37e80b4fef0b279 /ale_linters/perl
parentbd07d0467039a4b58d15c36ae9c8db2bc47806f3 (diff)
downloadale-c2ceb9e085c8dd849dee57bdd91b2500fa7b528f.zip
FIX #344 - Add options to Perl linter
Conflicts: doc/ale.txt
Diffstat (limited to 'ale_linters/perl')
-rw-r--r--ale_linters/perl/perl.vim20
1 files changed, 18 insertions, 2 deletions
diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim
index 4a4ea508..9d24ed9a 100644
--- a/ale_linters/perl/perl.vim
+++ b/ale_linters/perl/perl.vim
@@ -1,6 +1,22 @@
" 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', '-X -c -Mwarnings -Ilib')
+
+function! ale_linters#perl#perl#GetExecutable(buffer) abort
+ return g:ale_perl_perl_executable
+endfunction
+
+function! ale_linters#perl#perl#GetCommand(buffer) abort
+ return ale_linters#perl#perl#GetExecutable(a:buffer)
+ \ . ' ' . g:ale_perl_perl_options
+ \ . ' %t'
+endfunction
+
function! ale_linters#perl#perl#Handle(buffer, lines) abort
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
let l:output = []
@@ -32,8 +48,8 @@ endfunction
call ale#linter#Define('perl', {
\ 'name': 'perl',
-\ 'executable': 'perl',
+\ 'executable_callback': 'ale_linters#perl#perl#GetExecutable',
\ 'output_stream': 'both',
-\ 'command': 'perl -X -c -Mwarnings -Ilib',
+\ 'command_callback': 'ale_linters#perl#perl#GetCommand',
\ 'callback': 'ale_linters#perl#perl#Handle',
\})