mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
In addition to errors Zeek's parsing can also expose warning messages,
e.g., for the following code
```zeek
event http_stats(c: connection, stats: http_stats_rec) {
c$removal_hooks;
}
```
a warning is emitted
```
warning in /tmp/foo.zeek, line 2: expression value ignored (c$removal_hooks)
```
This patch adds parsing and propagation of these warning messages.
24 lines
736 B
VimL
24 lines
736 B
VimL
" Author: Benjamin Bannier <bbannier@gmail.com>
|
|
" Description: Support for checking Zeek files.
|
|
"
|
|
call ale#Set('zeek_zeek_executable', 'zeek')
|
|
|
|
function! ale_linters#zeek#zeek#HandleErrors(buffer, lines) abort
|
|
let l:pattern = '\(error\|warning\) in \v.*, line (\d+): (.*)$'
|
|
|
|
return map(ale#util#GetMatches(a:lines, l:pattern), "{
|
|
\ 'lnum': str2nr(v:val[2]),
|
|
\ 'text': v:val[3],
|
|
\ 'type': (v:val[1] is# 'error') ? 'E': 'W',
|
|
\}")
|
|
endfunction
|
|
|
|
call ale#linter#Define('zeek', {
|
|
\ 'name': 'zeek',
|
|
\ 'executable': {b -> ale#Var(b, 'zeek_zeek_executable')},
|
|
\ 'output_stream': 'stderr',
|
|
\ 'command': {-> '%e --parse-only %s'},
|
|
\ 'callback': 'ale_linters#zeek#zeek#HandleErrors',
|
|
\ 'lint_file': 1,
|
|
\})
|