def match()

in qs_cfn_lint_rules/Labels.py [0:0]


    def match(self, cfn):
        """Basic Matching"""
        matches = []
        message = 'Parameter {0} is missing ParameterLabel'
        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 "ParameterLabels" in cfn.template["Metadata"]["AWS::CloudFormation::Interface"].keys():
                    for x in cfn.template["Metadata"]["AWS::CloudFormation::Interface"]["ParameterLabels"]:
                        labels.append(str(x))

        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