dense-analysis / dense-analysis/ale
Add mandoc lint filter for mdoc nroff files
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
I have created the below mandoc linter and handler. I am not (yet) familiar with Vader but wanted to submit these two files for review and ask for advice on what additional materials needs to be submitted.
# ale_linters/nroff/mandoc.vim
```
" Author: F Harvell https://github.com/fharvell
" Description: mandoc for nroff files
call ale#linter#Define('nroff', {
\ 'name': 'mandoc',
\ 'executable': 'mandoc',
\ 'command': 'mandoc -Tlint %t',
\ 'callback': 'ale#handlers#mandoc#HandleMandocFormat'
\})
```
# autoload/ale/handlers/mandoc.vim
```
" Author: F Harvell https://github.com/fharvell
" Description: Error handling for mandoc lint.
function! ale#handlers#mandoc#HandleMandocFormat(buffer, lines) abort
let l:pattern = '\v^mandoc: +[^:]*:(\d+):(\d+): +(.*)$'
let l:output = []
let l:type = 'I'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if l:match[3] =~? 'ERROR'
let l:type = 'E'
elseif l:match[3] =~? 'WARNING'
let l:type = 'W'
else
"elseif l:match[3] =~? 'STYLE'
let l:type = 'I'
endif
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3],
\ 'type': l:type
\})
endfor
return l:output
endfunction
```
Contributor guide
Assessment
This issue has not been assessed yet.