Skip to content

Commit 458a582

Browse files
committed
Update additional rules to use helpers
1 parent 05c642a commit 458a582

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

src/cfnlint/rules/functions/Join.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import six
66
from cfnlint.rules import CloudFormationLintRule
77
from cfnlint.rules import RuleMatch
8-
from cfnlint.helpers import RESOURCE_SPECS
8+
from cfnlint.helpers import RESOURCE_SPECS, VALID_PARAMETER_TYPES_LIST
99

1010

1111
class Join(CloudFormationLintRule):
@@ -51,16 +51,8 @@ def _is_ref_a_list(self, parameter, template_parameters):
5151
'AWS::NotificationARNs',
5252
]
5353

54-
odd_list_params = [
55-
'CommaDelimitedList',
56-
'AWS::SSM::Parameter::Value<CommaDelimitedList>',
57-
]
58-
5954
if parameter in template_parameters:
60-
if (
61-
template_parameters.get(parameter) in odd_list_params or
62-
template_parameters.get(parameter).startswith('AWS::SSM::Parameter::Value<List') or
63-
template_parameters.get(parameter).startswith('List')):
55+
if template_parameters.get(parameter) in VALID_PARAMETER_TYPES_LIST:
6456
return True
6557
if parameter in list_params:
6658
return True

src/cfnlint/rules/functions/Sub.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
SPDX-License-Identifier: MIT-0
44
"""
55
import six
6-
from cfnlint.helpers import PSEUDOPARAMS
6+
from cfnlint.helpers import PSEUDOPARAMS, VALID_PARAMETER_TYPES_LIST
77
from cfnlint.rules import CloudFormationLintRule
88
from cfnlint.rules import RuleMatch
99

@@ -98,11 +98,6 @@ def _test_parameter(self, parameter, cfn, parameters, tree):
9898
matches = []
9999
get_atts = cfn.get_valid_getatts()
100100

101-
odd_list_params = [
102-
'CommaDelimitedList',
103-
'AWS::SSM::Parameter::Value<CommaDelimitedList>',
104-
]
105-
106101
valid_params = list(PSEUDOPARAMS)
107102
valid_params.extend(cfn.get_resource_names())
108103
template_parameters = self._get_parameters(cfn)
@@ -114,10 +109,7 @@ def _test_parameter(self, parameter, cfn, parameters, tree):
114109
found = False
115110
if parameter in template_parameters:
116111
found = True
117-
if (
118-
template_parameters.get(parameter) in odd_list_params or
119-
template_parameters.get(parameter).startswith('AWS::SSM::Parameter::Value<List') or
120-
template_parameters.get(parameter).startswith('List')):
112+
if template_parameters.get(parameter) in VALID_PARAMETER_TYPES_LIST:
121113
message = 'Fn::Sub cannot use list {0} at {1}'
122114
matches.append(RuleMatch(
123115
tree, message.format(parameter, '/'.join(map(str, tree)))))

0 commit comments

Comments
 (0)