Skip to content

Commit da3d52d

Browse files
authored
Fix an issue with E3031 so all regex checks are run (#2873)
1 parent 13d4ead commit da3d52d

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/cfnlint/rules/resources/properties/AllowedPattern.py

+6-14
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,16 @@ def check_value(self, value, path, property_name, **kwargs):
8181

8282
return matches
8383

84-
def check(self, cfn, properties, value_specs, property_specs, path):
84+
def check(self, cfn, properties, property_specs, path):
8585
"""Check itself"""
8686
matches = []
8787
for p_value, p_path in properties.items_safe(path[:]):
8888
for prop in p_value:
89-
if prop in value_specs:
90-
value = value_specs.get(prop).get("Value", {})
89+
if prop in property_specs:
90+
value = property_specs.get(prop).get("Value", {})
9191
if value:
9292
value_type = value.get("ValueType", "")
93-
property_type = (
94-
property_specs.get("Properties").get(prop).get("Type")
95-
)
93+
property_type = property_specs.get(prop).get("Type")
9694
value_specs = (
9795
RESOURCE_SPECS.get(cfn.regions[0])
9896
.get("ValueTypes")
@@ -128,10 +126,7 @@ def match_resource_sub_properties(self, properties, property_type, path, cfn):
128126
.get(property_type, {})
129127
.get("Properties", {})
130128
)
131-
property_specs = (
132-
RESOURCE_SPECS.get(cfn.regions[0]).get("PropertyTypes").get(property_type)
133-
)
134-
matches.extend(self.check(cfn, properties, specs, property_specs, path))
129+
matches.extend(self.check(cfn, properties, specs, path))
135130

136131
return matches
137132

@@ -145,9 +140,6 @@ def match_resource_properties(self, properties, resource_type, path, cfn):
145140
.get(resource_type, {})
146141
.get("Properties", {})
147142
)
148-
resource_specs = (
149-
RESOURCE_SPECS.get(cfn.regions[0]).get("ResourceTypes").get(resource_type)
150-
)
151-
matches.extend(self.check(cfn, properties, specs, resource_specs, path))
143+
matches.extend(self.check(cfn, properties, specs, path))
152144

153145
return matches

0 commit comments

Comments
 (0)