@@ -155,21 +155,22 @@ def getChanges(self, target_branch:str)->List[Detection]:
155
155
print (f"[{ len (updated_detections )} ] Pieces of modifed and new content (this may include experimental/deprecated/manual_test content):\n - { modifiedAndNewContentString } " )
156
156
return updated_detections
157
157
158
- def getSelected (self , detectionFilenames :List [FilePath ])-> List [Detection ]:
159
- filepath_to_content_map :dict [FilePath , SecurityContentObject ] = { obj .file_path :obj for (_ ,obj ) in self .director .name_to_content_map .items () if obj .file_path is not None }
158
+ def getSelected (self , detectionFilenames : List [FilePath ]) -> List [Detection ]:
159
+ filepath_to_content_map : dict [FilePath , SecurityContentObject ] = {
160
+ obj .file_path : obj for (_ , obj ) in self .director .name_to_content_map .items () if obj .file_path is not None
161
+ }
160
162
errors = []
161
- detections :List [Detection ] = []
163
+ detections : List [Detection ] = []
162
164
for name in detectionFilenames :
163
- obj = filepath_to_content_map .get (name ,None )
164
- if obj == None :
165
+ obj = filepath_to_content_map .get (name , None )
166
+ if obj is None :
165
167
errors .append (f"There is no detection file or security_content_object at '{ name } '" )
166
168
elif not isinstance (obj , Detection ):
167
169
errors .append (f"The security_content_object at '{ name } ' is of type '{ type (obj ).__name__ } ', NOT '{ Detection .__name__ } '" )
168
170
else :
169
171
detections .append (obj )
170
172
171
- if len ( errors ) > 0 :
173
+ if errors :
172
174
errorsString = "\n - " .join (errors )
173
- raise Exception (f"There following errors were encountered while getting selected detections to test:\n - { errorsString } " )
174
- return detections
175
-
175
+ raise Exception (f"The following errors were encountered while getting selected detections to test:\n - { errorsString } " )
176
+ return detections
0 commit comments