Merge pull request #1665 from ashemedai/master
Make CloudFormation linter work again with latest version
This commit is contained in:
commit
90dfe8e2a4
@ -4,8 +4,8 @@
|
|||||||
function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort
|
function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort
|
||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" sample.template.yaml:96:7:96:15: [E3012] Property Resources/Sample/Properties/FromPort should be of type Integer
|
" sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer
|
||||||
let l:pattern = '\v^(.*):(\d+):(\d+):(\d+):(\d+): \[([[:alnum:]]+)\] (.*)$'
|
let l:pattern = '\v^(.*):(\d+):(\d+):(\d+):(\d+):([[:alnum:]]+):(.*)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
@ -13,13 +13,13 @@ function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2],
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3],
|
||||||
\ 'end_lnum': l:match[4] + 0,
|
\ 'end_lnum': l:match[4],
|
||||||
\ 'end_col': l:match[5] + 0,
|
\ 'end_col': l:match[5],
|
||||||
\ 'text': l:match[7],
|
|
||||||
\ 'code': l:code,
|
\ 'code': l:code,
|
||||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||||
|
\ 'text': l:match[7]
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -9,25 +9,25 @@ Execute(The cfn_python_lint handler should parse items correctly):
|
|||||||
AssertEqual
|
AssertEqual
|
||||||
\ [
|
\ [
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 96,
|
\ 'lnum': '96',
|
||||||
\ 'col': 7,
|
\ 'col': '7',
|
||||||
\ 'end_lnum': 96,
|
\ 'end_lnum': '96',
|
||||||
\ 'end_col': 15,
|
\ 'end_col': '15',
|
||||||
\ 'text': 'Property Resources/Sample/Properties/FromPort should be of type Integer',
|
\ 'text': 'Property Resources/Sample/Properties/FromPort should be of type Integer',
|
||||||
\ 'code': 'E3012',
|
\ 'code': 'E3012',
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 97,
|
\ 'lnum': '97',
|
||||||
\ 'col': 7,
|
\ 'col': '7',
|
||||||
\ 'end_lnum': 97,
|
\ 'end_lnum': '97',
|
||||||
\ 'end_col': 15,
|
\ 'end_col': '15',
|
||||||
\ 'text': 'AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"',
|
\ 'text': 'AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"',
|
||||||
\ 'code': 'W2509',
|
\ 'code': 'W2509',
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#cloudformation#cfn_python_lint#Handle(bufnr(''), [
|
\ ale_linters#cloudformation#cfn_python_lint#Handle(bufnr(''), [
|
||||||
\ fnamemodify(tempname(), ':h') . '/sample.template.yaml:96:7:96:15: [E3012] Property Resources/Sample/Properties/FromPort should be of type Integer',
|
\ fnamemodify(tempname(), ':h') . '/sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer',
|
||||||
\ fnamemodify(tempname(), ':h') . '/sample.template.yaml:97:7:97:15: [W2509] AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"',
|
\ fnamemodify(tempname(), ':h') . '/sample.template.yaml:97:7:97:15:W2509:AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"',
|
||||||
\ ])
|
\ ])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user