forked from aws-cloudformation/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CfnLint.py
37 lines (31 loc) · 1.25 KB
/
CfnLint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from cfnlint.jsonschema._utils import Unset
from cfnlint.rules import CloudFormationLintRule
class CfnLint(CloudFormationLintRule):
id = "E1101"
shortdesc = "Validate an item against additional checks"
description = "Use supplemental logic to validate properties against"
tags = []
# pylint: disable=unused-argument
def cfnLint(self, validator, keywords, instance, schema):
validator = validator.evolve(
function_filter=validator.function_filter.evolve(
add_cfn_lint_keyword=False,
)
)
for keyword in keywords:
for rule in self.child_rules.values():
if rule is None:
continue
if not rule.id:
continue
for rule_keyword in rule.keywords:
if rule_keyword == keyword:
for err in rule.validate(validator, keyword, instance, schema):
if err.rule is None:
if isinstance(err.validator, Unset):
err.rule = rule
yield err