install.fairie/dotfiles/.vim/plugged/ale/ale_linters/salt/salt_lint.vim
Git E2E Dev Test Username e149692cc9 git subrepo clone https://github.com/dense-analysis/ale.git ./dotfiles/.vim/plugged/ale
subrepo:
  subdir:   "dotfiles/.vim/plugged/ale"
  merged:   "e4b205440"
upstream:
  origin:   "https://github.com/dense-analysis/ale.git"
  branch:   "master"
  commit:   "e4b205440"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:09 -04:00

33 lines
1 KiB
VimL

" Author: Benjamin BINIER <poulpatine@gmail.com>
" Description: salt-lint, saltstack linter
call ale#Set('salt_salt_lint_executable', 'salt-lint')
call ale#Set('salt_salt_lint_options', '')
function! ale_linters#salt#salt_lint#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'salt_salt_lint_options'))
\ . ' --json'
endfunction
function! ale_linters#salt#salt_lint#Handle(buffer, lines) abort
let l:output = []
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
call add(l:output, {
\ 'lnum': l:error.linenumber + 0,
\ 'code': l:error.id + 0,
\ 'text': l:error.message,
\ 'type': l:error.severity is# 'HIGH' ? 'E' : 'W',
\})
endfor
return l:output
endfunction
call ale#linter#Define('salt', {
\ 'name': 'salt_lint',
\ 'aliases': ['salt-lint'],
\ 'executable': {b -> ale#Var(b, 'salt_salt_lint_executable')},
\ 'command': function('ale_linters#salt#salt_lint#GetCommand'),
\ 'callback': 'ale_linters#salt#salt_lint#Handle'
\})