diff options
-rw-r--r-- | ale_linters/perl/perl.vim | 9 | ||||
-rw-r--r-- | doc/ale-perl.txt | 6 | ||||
-rw-r--r-- | test/command_callback/test_perl_command_callback.vader | 37 |
3 files changed, 7 insertions, 45 deletions
diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim index 6421d4ff..33288061 100644 --- a/ale_linters/perl/perl.vim +++ b/ale_linters/perl/perl.vim @@ -1,15 +1,18 @@ " Author: Vincent Lequertier <https://github.com/SkySymbol> " Description: This file adds support for checking perl syntax -call ale#Set('perl_perl_executable', 'perl') -call ale#Set('perl_perl_options', '-w -Mwarnings -Ilib') +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 function! ale_linters#perl#perl#GetCommand(buffer) abort - return ale#Escape(ale_linters#perl#perl#GetExecutable(a:buffer)) + return ale_linters#perl#perl#GetExecutable(a:buffer) \ . ' ' . ale#Var(a:buffer, 'perl_perl_options') \ . ' %t' endfunction diff --git a/doc/ale-perl.txt b/doc/ale-perl.txt index 7142d241..7611d30f 100644 --- a/doc/ale-perl.txt +++ b/doc/ale-perl.txt @@ -16,15 +16,11 @@ g:ale_perl_perl_executable *g:ale_perl_perl_executable* g:ale_perl_perl_options *g:ale_perl_perl_options* *b:ale_perl_perl_options* Type: |String| - Default: `'-w -Mwarnings -Ilib'` + Default: `'-c -Mwarnings -Ilib'` This variable can be changed to alter the command-line arguments to the perl invocation. - Perl code is checked with `-w` by default, because `-c` can execute - malicious code. You can use the `-c` option at your own risk. See - |g:ale_pattern_options| for changing the option only for specific files. - =============================================================================== perlcritic *ale-perl-perlcritic* diff --git a/test/command_callback/test_perl_command_callback.vader b/test/command_callback/test_perl_command_callback.vader deleted file mode 100644 index e82f2279..00000000 --- a/test/command_callback/test_perl_command_callback.vader +++ /dev/null @@ -1,37 +0,0 @@ -Before: - Save g:ale_perl_perl_executable - Save g:ale_perl_perl_options - - unlet! g:ale_perl_perl_executable - unlet! g:ale_perl_perl_options - - runtime ale_linters/perl/perl.vim - -After: - Restore - - unlet! b:ale_perl_perl_executable - unlet! b:ale_perl_perl_options - - call ale#linter#Reset() - -Execute(The default Perl command callback should be correct): - AssertEqual - \ 'perl', - \ ale_linters#perl#perl#GetExecutable(bufnr('')) - - AssertEqual - \ ale#Escape('perl') . ' -w -Mwarnings -Ilib %t', - \ ale_linters#perl#perl#GetCommand(bufnr('')) - -Execute(Overriding the executable and command should work): - let b:ale_perl_perl_executable = 'foobar' - let b:ale_perl_perl_options = '-c' - - AssertEqual - \ 'foobar', - \ ale_linters#perl#perl#GetExecutable(bufnr('')) - - AssertEqual - \ ale#Escape('foobar') . ' -c %t', - \ ale_linters#perl#perl#GetCommand(bufnr('')) |