def match()

in shared/lint/rules/custom_rules.py [0:0]


    def match(self, cfn):
        """
        Match Events Rules that don't have a corresponding EventInvokeConfig
        """

        matches = []

        function_names = cfn.get_resources("AWS::Lambda::Function").keys()
        rules = cfn.get_resources("AWS::Events::Rule")
        invoke_configs = cfn.get_resources("AWS::Lambda::EventInvokeConfig")

        # Get the list of function names with EventInvokeConfig and OnFailure
        invoke_config_functions = []
        for resource in invoke_configs.values():
            if resource.get("Properties", {}).get("DestinationConfig", {}).get("OnFailure", None) is None:
                continue
            invoke_config_functions.append(resource["Properties"]["FunctionName"]["Ref"])

        # Parse rules
        for key, resource in rules.items():
            for target in resource.get("Properties", {}).get("Targets", []):
                if target.get("Arn", {}).get("Fn::GetAtt", None) is None:
                    continue

                if target["Arn"]["Fn::GetAtt"][0] not in function_names:
                    continue

                function_name = target["Arn"]["Fn::GetAtt"][0]
                if function_name not in invoke_config_functions:
                    matches.append(RuleMatch(
                        ["Resources", key],
                        self._message.format(key)
                    ))

        return matches