summaryrefslogtreecommitdiff
path: root/ale_linters/awk/gawk.vim
diff options
context:
space:
mode:
authorAnthony DeDominic <anthony@dedominic.pw>2018-03-14 13:46:57 -0400
committerw0rp <w0rp@users.noreply.github.com>2018-03-14 17:46:57 +0000
commit92e6e4d1ba482a4d2d89d850f660c67ccf8a28eb (patch)
tree11ab1ede3531351a95b708ab443158a792f5633e /ale_linters/awk/gawk.vim
parent05d39bc1a9eb79ff6f36b190b4612ff052812e7e (diff)
downloadale-92e6e4d1ba482a4d2d89d850f660c67ccf8a28eb.zip
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
Diffstat (limited to 'ale_linters/awk/gawk.vim')
-rw-r--r--ale_linters/awk/gawk.vim6
1 files changed, 5 insertions, 1 deletions
diff --git a/ale_linters/awk/gawk.vim b/ale_linters/awk/gawk.vim
index ac6e9154..3e9987b3 100644
--- a/ale_linters/awk/gawk.vim
+++ b/ale_linters/awk/gawk.vim
@@ -12,7 +12,11 @@ function! ale_linters#awk#gawk#GetExecutable(buffer) abort
endfunction
function! ale_linters#awk#gawk#GetCommand(buffer) abort
+ " note the --source 'BEGIN ...' is to prevent
+ " gawk from attempting to execute the body of the script
+ " it is linting.
return ale_linters#awk#gawk#GetExecutable(a:buffer)
+ \ . " --source 'BEGIN { exit } END { exit 1 }'"
\ . ' ' . ale#Var(a:buffer, 'awk_gawk_options')
\ . ' ' . '-f %t --lint /dev/null'
endfunction
@@ -21,6 +25,6 @@ call ale#linter#Define('awk', {
\ 'name': 'gawk',
\ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable',
\ 'command_callback': 'ale_linters#awk#gawk#GetCommand',
-\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
+\ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
\ 'output_stream': 'both'
\})