summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/perl/perl.vim20
-rw-r--r--doc/ale.txt20
2 files changed, 38 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',
\})
diff --git a/doc/ale.txt b/doc/ale.txt
index bc5e927b..12df2b4e 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -41,6 +41,8 @@ CONTENTS *ale-contents*
4.29. xo..............................|ale-linter-options-xo|
4.30. javac...........................|ale-linter-options-javac|
4.31. yamllint........................|ale-linter-options-yamllint|
+ 4.32. cmakelint.......................|ale-linter-options-cmakelint|
+ 4.33. perl-perl.......................|ale-linter-options-perl-perl|
5. Linter Integration Notes.............|ale-linter-integration|
5.1. merlin..........................|ale-linter-integration-ocaml-merlin|
5.2. rust.............................|ale-integration-rust|
@@ -1097,6 +1099,24 @@ g:ale_cmake_cmakelint_options *g:ale_cmake_cmakelint_options*
This variable can be set to pass additional options to cmakelint.
+-------------------------------------------------------------------------------
+4.33. perl-perl *ale-linter-options-perl-perl*
+
+g:ale_perl_perl_executable *g:ale_perl_perl_executable*
+
+ Type: |String|
+ Default: `'perl'`
+
+ This variable can be changed to modify the executable used for linting perl.
+
+
+g:ale_perl_perl_options *g:ale_perl_perl_options*
+
+ Type: |String|
+ Default: `'-X -c -Mwarnings -Ilib'`
+
+ This variable can be changed to alter the command-line arguments to the perl
+ invocation.
===============================================================================
5. Linter Integration Notes *ale-linter-integration*