mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 05:24:46 +08:00
Fix awk linter and security concerns. (#1411)
* Fixed (g)awk linter * Made it secure, albeit less useful. * Added gawk handler; the cpplint one was not working? * Added gawk handler test. * added warning to gawk handler. * added gawk command callback test * added comment about --source * added back optional commandline option
This commit is contained in:
40
test/command_callback/test_gawk_command_callback.vader
Normal file
40
test/command_callback/test_gawk_command_callback.vader
Normal file
@@ -0,0 +1,40 @@
|
||||
Before:
|
||||
Save g:ale_awk_gawk_executable
|
||||
Save g:ale_awk_gawk_options
|
||||
unlet! g:ale_awk_gawk_executable
|
||||
unlet! g:ale_awk_gawk_options
|
||||
|
||||
runtime ale_linters/awk/gawk.vim
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_awk_gawk_executable
|
||||
unlet! b:ale_awk_gawk_options
|
||||
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ 'gawk'
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' ' . '-f %t --lint /dev/null',
|
||||
\ ale_linters#awk#gawk#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_awk_gawk_executable = '/other/gawk'
|
||||
|
||||
AssertEqual
|
||||
\ '/other/gawk'
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' ' . '-f %t --lint /dev/null',
|
||||
\ ale_linters#awk#gawk#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_awk_gawk_executable = 'gawk'
|
||||
let b:ale_awk_gawk_options = '--something'
|
||||
|
||||
AssertEqual
|
||||
\ 'gawk'
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' --something'
|
||||
\ . ' ' . '-f %t --lint /dev/null',
|
||||
\ ale_linters#awk#gawk#GetCommand(bufnr(''))
|
||||
Reference in New Issue
Block a user