def match()

in qs_cfn_lint_rules/Groups.py [0:0]


    def match(self, cfn):
        """Basic Matching"""
        matches = []
        message = 'Parameter {0} is not in a ParameterGroup'
        labels = []
        if self.id in cfn.template.get("Metadata", {}).get("QSLint", {}).get("Exclusions", []):
            return matches
        if "Metadata" in cfn.template.keys():
            if "AWS::CloudFormation::Interface" in cfn.template["Metadata"].keys():
                if "ParameterGroups" in cfn.template["Metadata"]["AWS::CloudFormation::Interface"].keys():
                    for x in cfn.template["Metadata"]["AWS::CloudFormation::Interface"]["ParameterGroups"]:
                        labels += x['Parameters']

        if "Parameters" not in cfn.template.keys():
            return matches
        else:
            for x in cfn.template["Parameters"]:
                if str(x) not in labels:
                    matches.append(RuleMatch(["Parameters", x], message.format(x)))
        return matches