|
| 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