mirror of
https://github.com/splunk/security_content
synced 2026-06-08 17:32:49 +00:00
Check all files and accumulate
all errors before raising any exceptions.
This commit is contained in:
@@ -164,10 +164,22 @@ class GithubService:
|
||||
#We are down to just the detections we care about
|
||||
#Parse and load each of them, which will ensure that they pass their validations
|
||||
import modules.test_driver
|
||||
detection_objects = [modules.test_driver.Detection(d) for d in detections]
|
||||
detection_objects = []
|
||||
errors = []
|
||||
for detection in detections:
|
||||
try:
|
||||
detection_objects.append(modules.test_driver.Detection(detection))
|
||||
except Exception as e:
|
||||
errors.append(f"Error parsing detection {detection}: {str(e)}")
|
||||
|
||||
if len(errors) != 0:
|
||||
all_errors_string = '\n\t'.join(errors)
|
||||
raise Exception(f"The following errors were encountered while parsing detections:\n\t{all_errors_string}")
|
||||
|
||||
|
||||
print(f"Detection objects that were parsed: {len(detection_objects)}")
|
||||
|
||||
|
||||
detection_objects = [d for d in detection_objects if d.detectionFile.type in allowed_types]
|
||||
|
||||
print(f"Detection objects after downselecting to {allowed_types}: {len(detection_objects)}")
|
||||
|
||||
Reference in New Issue
Block a user