FIX #344 - Add options to Perl linter

Conflicts:
	doc/ale.txt
This commit is contained in:
Paul Johnson 2017-02-26 14:50:43 +01:00 committed by w0rp
parent bd07d04670
commit c2ceb9e085
2 changed files with 38 additions and 2 deletions

View File

@ -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',
\})

View File

@ -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*