Skip to content

Commit

Permalink
Update E2015 to split defaults on comma (#3466)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Jul 5, 2024
1 parent 8a40ff1 commit 9f6e8f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cfnlint/rules/parameters/Default.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = []
Expand All @@ -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(",")
]
Expand All @@ -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)
)
Expand Down

0 comments on commit 9f6e8f4

Please sign in to comment.