mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-20 00:28:35 +08:00
Merge pull request #3424 from maxice8/atools
Add support for Alpine Linux APKBUILD
This commit is contained in:
41
autoload/ale/handlers/atools.vim
Normal file
41
autoload/ale/handlers/atools.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
" Author: Leo <thinkabit.ukim@gmail.com>
|
||||
" Description: Handlers for output expected from atools
|
||||
|
||||
function! ale#handlers#atools#Handle(buffer, lines) abort
|
||||
" Format: SEVERITY:[TAG]:PATH:LINENUM:MSG
|
||||
" Example: MC:[AL5]:./APKBUILD:12:variable set to empty string: install=
|
||||
let l:pattern = '\([^:]\+\):\([^:]\+\):\([^:]\+\):\(\d\+\):\(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" We are expected to receive 2 characters, the first character
|
||||
" can be 'S', 'I', 'M' 'T', which are respectively:
|
||||
" Serious (Error)
|
||||
" Important (Error)
|
||||
" Minor (Warning)
|
||||
" Style (Warning)
|
||||
"
|
||||
" The second character can be either 'C' or 'P', which are respectively:
|
||||
" Certain (Error)
|
||||
" Possible (Warning)
|
||||
let l:severity = matchstr(l:match[1], '^.')
|
||||
let l:certainty = matchstr(l:match[1], '.$')
|
||||
|
||||
let l:type = 'E'
|
||||
" If the tag returns 'Minor' or 'Style' or is 'Possible'
|
||||
" then return a warning
|
||||
|
||||
if l:severity is# 'M' || l:severity is# 'T' || l:certainty is# 'P'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'type': l:type,
|
||||
\ 'code': matchstr(l:match[2], 'AL[0-9]*'),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
@@ -38,6 +38,7 @@ let s:default_ale_linter_aliases = {
|
||||
"
|
||||
" NOTE: Update the g:ale_linters documentation when modifying this.
|
||||
let s:default_ale_linters = {
|
||||
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
|
||||
\ 'csh': ['shell'],
|
||||
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
|
||||
\ 'go': ['gofmt', 'golint', 'go vet'],
|
||||
|
||||
Reference in New Issue
Block a user