def check_runtime()

in qs_cfn_lint_rules/LambdaRuntimeEOL.py [0:0]


    def check_runtime(self, runtime_value, path):
        """ Check if the given runtime is valid"""
        matches = []

        runtime = self.deprecated_runtimes.get(runtime_value)
        if runtime:
            eol = datetime.strptime(runtime['eol'], '%Y-%m-%d')
            if eol < self.current_date:
                return matches
            if self.current_date > (eol+timedelta(days=-90)):
                new_id = self.id.replace('W','E')
                old_id = self.id
                self.id = new_id
                message = 'Runtime ({0}) will be EOL on {1}. Please consider updating to {2}'
                matches.append(
                    RuleMatch(
                        path,
                        message.format(
                            runtime_value,
                            runtime['eol'],
                            runtime['successor'])))
            elif self.current_date > (eol+timedelta(days=-365)):
                message = 'Runtime ({0}) will be EOL on {1}. Please consider updating to {2}'
                matches.append(
                    RuleMatch(
                        path,
                        message.format(
                            runtime_value,
                            runtime['eol'],
                            runtime['successor'])))
        return matches