mirror of
https://github.com/amix/vimrc
synced 2025-07-31 01:35:01 +08:00
Removed syntastic and replaced it with ale
Read more here: https://github.com/w0rp/ale
This commit is contained in:
28
sources_non_forked/ale/ale_linters/puppet/puppet.vim
Normal file
28
sources_non_forked/ale/ale_linters/puppet/puppet.vim
Normal file
@ -0,0 +1,28 @@
|
||||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||
|
||||
function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
|
||||
" Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5"
|
||||
|
||||
let l:pattern = '^Error: .*: \(.\+\) at .\+\.pp:\(\d\+\):\=\(\d*\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[1],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('puppet', {
|
||||
\ 'name': 'puppet',
|
||||
\ 'executable': 'puppet',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': 'puppet parser validate --color=false %t',
|
||||
\ 'callback': 'ale_linters#puppet#puppet#Handle',
|
||||
\})
|
26
sources_non_forked/ale/ale_linters/puppet/puppetlint.vim
Normal file
26
sources_non_forked/ale/ale_linters/puppet/puppetlint.vim
Normal file
@ -0,0 +1,26 @@
|
||||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>, Robert Flechtner <flechtner@chemmedia.de>
|
||||
" Description: puppet-lint for puppet files
|
||||
|
||||
let g:ale_puppet_puppetlint_executable =
|
||||
\ get(g:, 'ale_puppet_puppetlint_executable', 'puppet-lint')
|
||||
|
||||
let g:ale_puppet_puppetlint_options =
|
||||
\ get(g:, 'ale_puppet_puppetlint_options', '--no-autoloader_layout-check')
|
||||
|
||||
function! ale_linters#puppet#puppetlint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'puppet_puppetlint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#puppet#puppetlint#GetCommand(buffer) abort
|
||||
return ale_linters#puppet#puppetlint#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'puppet_puppetlint_options')
|
||||
\ . ' --log-format "-:%{line}:%{column}: %{kind}: [%{check}] %{message}"'
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('puppet', {
|
||||
\ 'name': 'puppetlint',
|
||||
\ 'executable_callback': 'ale_linters#puppet#puppetlint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#puppet#puppetlint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
Reference in New Issue
Block a user