summaryrefslogtreecommitdiff
path: root/autoload
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 /autoload
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 'autoload')
-rw-r--r--autoload/ale/handlers/gawk.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/autoload/ale/handlers/gawk.vim b/autoload/ale/handlers/gawk.vim
new file mode 100644
index 00000000..942bc2b2
--- /dev/null
+++ b/autoload/ale/handlers/gawk.vim
@@ -0,0 +1,25 @@
+" Author: Anthony DeDominic <adedomin@gmail.com>
+" Description: Handle output from gawk's --lint option
+
+function! ale#handlers#gawk#HandleGawkFormat(buffer, lines) abort
+ " Look for lines like the following:
+ " gawk: /tmp/v0fddXz/1/something.awk:1: ^ invalid char ''' in expression
+ let l:pattern = '^.\{-}:\(\d\+\):\s\+\(warning:\|\^\)\s*\(.*\)'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ let l:ecode = 'E'
+ if l:match[2] is? 'warning:'
+ let l:ecode = 'W'
+ endif
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': 0,
+ \ 'text': l:match[3],
+ \ 'code': 0,
+ \ 'type': l:ecode,
+ \})
+ endfor
+
+ return l:output
+endfunction