@@ -164,7 +164,7 @@ def is_rule_enabled(self, rule_id):
164164
165165 def resource_property (self , filename , cfn , path , properties , resource_type , property_type ):
166166 """Run loops in resource checks for embedded properties"""
167- matches = list ()
167+ matches = []
168168 property_spec = cfnlint .helpers .RESOURCE_SPECS ['us-east-1' ].get ('PropertyTypes' )
169169 if property_type == 'Tag' :
170170 property_spec_name = 'Tag'
@@ -221,7 +221,7 @@ def resource_property(self, filename, cfn, path, properties, resource_type, prop
221221
222222 def run_resource (self , filename , cfn , resource_type , resource_properties , path ):
223223 """Run loops in resource checks for embedded properties"""
224- matches = list ()
224+ matches = []
225225 resource_spec = cfnlint .helpers .RESOURCE_SPECS ['us-east-1' ].get ('ResourceTypes' )
226226 if resource_properties and resource_type in resource_spec :
227227 resource_spec_properties = resource_spec .get (resource_type , {}).get ('Properties' )
@@ -259,7 +259,7 @@ def run_resource(self, filename, cfn, resource_type, resource_properties, path):
259259
260260 def run (self , filename , cfn ):
261261 """Run rules"""
262- matches = list ()
262+ matches = []
263263 for rule in self .rules :
264264 try :
265265 matches .extend (rule .matchall (filename , cfn ))
@@ -423,7 +423,7 @@ def get_mappings(self):
423423 def get_resource_names (self ):
424424 """Get all the Resource Names"""
425425 LOGGER .debug ('Get the names of all resources from template...' )
426- results = list ()
426+ results = []
427427 resources = self .template .get ('Resources' , {})
428428 if isinstance (resources , dict ):
429429 for resourcename , _ in resources .items ():
@@ -434,7 +434,7 @@ def get_resource_names(self):
434434 def get_parameter_names (self ):
435435 """Get all Parameter Names"""
436436 LOGGER .debug ('Get names of all parameters from template...' )
437- results = list ()
437+ results = []
438438 parameters = self .template .get ('Parameters' , {})
439439 if isinstance (parameters , dict ):
440440 for parametername , _ in parameters .items ():
@@ -524,15 +524,15 @@ def _get_sub_resource_properties(self, keys, properties, path):
524524 if results :
525525 return results
526526 elif isinstance (properties , list ):
527- matches = list ()
527+ matches = []
528528 for index , item in enumerate (properties ):
529529 results = None
530530 if isinstance (item , dict ):
531531 if len (item ) == 1 :
532532 for sub_key , sub_value in item .items ():
533533 if sub_key in cfnlint .helpers .CONDITION_FUNCTIONS :
534534 cond_values = self .get_condition_values (sub_value )
535- results = list ()
535+ results = []
536536 for cond_value in cond_values :
537537 result_path = path [:] + [index , sub_key ] + cond_value ['Path' ]
538538 results .extend (
@@ -551,12 +551,12 @@ def _get_sub_resource_properties(self, keys, properties, path):
551551 matches .extend (results )
552552 return matches
553553
554- return list ()
554+ return []
555555
556556 def get_resource_properties (self , keys ):
557557 """Filter keys of template"""
558558 LOGGER .debug ('Get Properties from a resource: %s' , keys )
559- matches = list ()
559+ matches = []
560560 resourcetype = keys .pop (0 )
561561 for resource_name , resource_value in self .get_resources (resourcetype ).items ():
562562 path = ['Resources' , resource_name , 'Properties' ]
@@ -570,7 +570,7 @@ def get_resource_properties(self, keys):
570570 # pylint: disable=dangerous-default-value
571571 def _search_deep_keys (self , searchText , cfndict , path ):
572572 """Search deep for keys and get their values"""
573- keys = list ()
573+ keys = []
574574 if isinstance (cfndict , dict ):
575575 for key in cfndict :
576576 pathprop = path [:]
@@ -606,7 +606,7 @@ def search_deep_keys(self, searchText):
606606 def get_condition_values (self , template , path = []):
607607 """Evaluates conditions and brings back the values"""
608608 LOGGER .debug ('Get condition values...' )
609- matches = list ()
609+ matches = []
610610 if not isinstance (template , list ):
611611 return matches
612612 if not len (template ) == 3 :
@@ -656,7 +656,7 @@ def get_values(self, obj, key, path=[]):
656656
657657 """
658658 LOGGER .debug ('Get the value for key %s in %s' , key , obj )
659- matches = list ()
659+ matches = []
660660
661661 if not isinstance (obj , dict ):
662662 return None
@@ -774,7 +774,7 @@ def check_resource_property(self, resource_type, resource_property,
774774 check_join = None , check_sub = None , ** kwargs ):
775775 """ Check Resource Properties """
776776 LOGGER .debug ('Check property %s for %s' , resource_property , resource_type )
777- matches = list ()
777+ matches = []
778778 resources = self .get_resources (resource_type = resource_type )
779779 for resource_name , resource_object in resources .items ():
780780 properties = resource_object .get ('Properties' , {})
@@ -800,7 +800,7 @@ def check_value(self, obj, key, path,
800800 Check the value
801801 """
802802 LOGGER .debug ('Check value %s for %s' , key , obj )
803- matches = list ()
803+ matches = []
804804 values_obj = self .get_values (obj = obj , key = key )
805805 new_path = path [:] + [key ]
806806 if not values_obj :
@@ -882,14 +882,14 @@ def transform(self):
882882 def run (self ):
883883 """Run rules"""
884884 LOGGER .debug ('Run scan of template...' )
885- matches = list ()
885+ matches = []
886886 if self .cfn .template is not None :
887887 matches .extend (
888888 self .rules .run (
889889 self .filename , self .cfn ))
890890
891891 # uniq the list of incidents
892- return_matches = list ()
892+ return_matches = []
893893 for _ , match in enumerate (matches ):
894894 if not any (match == u for u in return_matches ):
895895 return_matches .append (match )
0 commit comments