Skip to content

Commit f60dc1e

Browse files
committed
Genesis
1 parent bf78e58 commit f60dc1e

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# vim-cfn
2+
3+
## Description
4+
5+
This is a vim plugin that provides CloudFormation syntax checking/highlighting

ftdetect/cloudformation.vim

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
autocmd BufNewFile,BufRead *.template setfiletype yaml.cloudformation

plugin/cloudformation.vim

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
" Vim syntastic plugin helper
2+
" Language: CloudFormation
3+
4+
if exists("g:loaded_syntastic_cloudformaiton_filetype")
5+
finish
6+
endif
7+
let g:loaded_syntastic_cloudformaiton_filetype = 1
8+
let s:save_cpo = &cpo
9+
set cpo&vim
10+
11+
12+
if exists('g:syntastic_extra_filetypes')
13+
call add(g:syntastic_extra_filetypes, 'cloudformation')
14+
else
15+
let g:syntastic_extra_filetypes = ['cloudformation']
16+
endif
17+
18+
let &cpo = s:save_cpo
19+
unlet s:save_cpo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"============================================================================
2+
"File: cfn_lint.vim
3+
"Description: CloudFormation linting for syntastic
4+
"Maintainer: Scott Peshak
5+
"License: This program is free software. It comes without any warranty,
6+
" to the extent permitted by applicable law. You can redistribute
7+
" it and/or modify it under the terms of the Do What The Fuck You
8+
" Want To Public License, Version 2, as published by Sam Hocevar.
9+
" See http://sam.zoy.org/wtfpl/COPYING for more details.
10+
"
11+
"============================================================================
12+
13+
if exists('g:loaded_syntastic_cloudformation_cfn_lint_checker')
14+
finish
15+
endif
16+
let g:loaded_syntastic_cloudformation_cfn_lint_checker = 1
17+
18+
let s:save_cpo = &cpo
19+
set cpo&vim
20+
21+
function! SyntaxCheckers_cloudformation_cfn_lint_GetLocList() dict
22+
let makeprg = self.makeprgBuild({
23+
\ "exe": 'cfn-lint',
24+
\ "args": "--template" })
25+
26+
" 2018-07-13 15:08:51,941 - cfnlint - ERROR - Template alb.template contains duplicates: "HasDefaultTargetGroupTCP" (line 282)
27+
let errorformat = '%*\d{4}-%*\d{2}-%*\d{2} %*\d{2}:%*\d{2}:%*\d{2}\,%\d{3} - cfnlint - %t%*[a-zA-Z] - %m \(line %l\),%EE%n\ %m,%C%f:%l:%c,%WW%n\ %m,%-G%.%#'
28+
29+
let loclist = SyntasticMake({
30+
\ 'makeprg': makeprg,
31+
\ 'errorformat': errorformat })
32+
33+
for e in loclist
34+
if e['type'] ==? 'W'
35+
let e['subtype'] = 'Style'
36+
endif
37+
endfor
38+
39+
return loclist
40+
endfunction
41+
42+
call g:SyntasticRegistry.CreateAndRegisterChecker({
43+
\ 'filetype': 'cloudformation',
44+
\ 'name': 'cfn_lint',
45+
\ 'exec': 'cfn-lint' })
46+
47+
let &cpo = s:save_cpo
48+
unlet s:save_cpo
49+
50+
" vim: set sw=4 sts=4 et fdm=marker:

0 commit comments

Comments
 (0)