Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update E2015 to split defaults on comma #3466

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading