From 9f6e8f4aee261977ffacf21acccf5200ecb4136e Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Fri, 5 Jul 2024 08:46:05 -0700 Subject: [PATCH] Update E2015 to split defaults on comma (#3466) --- src/cfnlint/rules/parameters/Default.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cfnlint/rules/parameters/Default.py b/src/cfnlint/rules/parameters/Default.py index 8d7f7dd62e..240cea7cae 100644 --- a/src/cfnlint/rules/parameters/Default.py +++ b/src/cfnlint/rules/parameters/Default.py @@ -6,6 +6,7 @@ import regex as re from cfnlint._typing import RuleMatches +from cfnlint.helpers import VALID_PARAMETER_TYPES_LIST from cfnlint.rules import CloudFormationLintRule, RuleMatch from cfnlint.template import Template @@ -127,8 +128,8 @@ def match_default_value(self, paramname, paramvalue, default_value): matches.extend(self.check_max_length(default_value, max_length, path)) return matches - def is_cdl(self, paramvalue): - return paramvalue.get("Type") == "CommaDelimitedList" + def is_list(self, paramvalue): + return paramvalue.get("Type") in VALID_PARAMETER_TYPES_LIST def match(self, cfn: Template) -> RuleMatches: matches = [] @@ -137,7 +138,7 @@ def match(self, cfn: Template) -> RuleMatches: param_cdl_matches = [] param_matches = [] default_value = paramvalue.get("Default") - if default_value is not None and self.is_cdl(paramvalue): + if default_value is not None and self.is_list(paramvalue): comma_delimited_default_values = [ x.strip() for x in default_value.split(",") ] @@ -146,7 +147,7 @@ def match(self, cfn: Template) -> RuleMatches: self.match_default_value(paramname, paramvalue, value) ) - if param_cdl_matches or not self.is_cdl(paramvalue): + if param_cdl_matches or not self.is_list(paramvalue): param_matches.extend( self.match_default_value(paramname, paramvalue, default_value) )