def match()

in qs_cfn_lint_rules/stack/MatchingParameterNotPassed.py [0:0]


    def match(self, cfn):
        """Basic Matching"""
        matches = []
        # try:
        resources = cfn.get_resources(
            resource_type=['AWS::CloudFormation::Stack']
        )

        parent_parameters = cfn.get_parameters()
        if type(parent_parameters) is None:
            parent_parameters = {}

        for r_name, r_values in resources.items():
            properties = r_values.get('Properties')
            child_template_url = properties.get('TemplateURL')

            child_template_parameters = properties.get('Parameters')
            if child_template_parameters is None:
                child_template_parameters = {}

            not_passed_to_child = self.matching_but_not_used_check(
                current_template_path=os.path.abspath(cfn.filename),
                parent_parameters=parent_parameters,
                resource_parameters=child_template_parameters,
                child_template_url=child_template_url,
                mappings = cfn.get_mappings()
            )

            if not_passed_to_child:
                path = ['Resources', r_name, 'Properties', 'Parameters']
                message = 'Parameter defined in Parent with same name as child,' \
                    ' however this value is never passed to child. {} {}'.format(
                        r_name,
                        not_passed_to_child
                    )
                matches.append(RuleMatch(path, message))
        return matches