mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 21:12:31 +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:
25
autoload/ale/handlers/gawk.vim
Normal file
25
autoload/ale/handlers/gawk.vim
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user