install.fairie/dotfiles/.vim/plugged/ale/ale_linters/yaml/circleci.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

35 lines
1 KiB
VimL

function! ale_linters#yaml#circleci#Handle(buffer, lines) abort
let l:match_index = -1
let l:output = []
for l:index in range(len(a:lines))
let l:line = a:lines[l:index]
if l:line =~? 'Error: ERROR IN CONFIG FILE:'
let l:match_index = l:index + 1
break
endif
endfor
if l:match_index > 0
return [{
\ 'type': 'E',
\ 'lnum': 1,
\ 'text': a:lines[l:match_index],
\ 'detail': join(a:lines[l:match_index :], "\n"),
\}]
endif
return []
endfunction
" The circleci validate requires network requests, so we'll only run it when
" files are saved to prevent the server from being hammered.
call ale#linter#Define('yaml', {
\ 'name': 'circleci',
\ 'executable': {b -> expand('#' . b . ':p') =~? '\.circleci' ? 'circleci' : ''},
\ 'command': 'circleci --skip-update-check config validate - < %s',
\ 'callback': 'ale_linters#yaml#circleci#Handle',
\ 'output_stream': 'stderr',
\ 'lint_file': 1,
\})