refactor(detector-evaluator): DetectorFilter is now used once to create a list of allowed detectors vs querying the filter every time.
@@ -274,7 +274,11 @@ public class DetectConfigurationFactory {
FilterableEnumList<DetectorType> included = getValue(DetectProperties.DETECT_INCLUDED_DETECTOR_TYPES);
ExcludeIncludeEnumFilter<DetectorType> detectorFilter = new ExcludeIncludeEnumFilter<>(excluded, included);
- return new DetectorEvaluationOptions(forceNestedSearch, getFollowSymLinks(), (rule -> detectorFilter.shouldInclude(rule.getDetectorType())));
+ Set<DetectorType> includedTypes = Arrays.stream(DetectorType.values())
+ .filter(detectorFilter::shouldInclude)
+ .collect(Collectors.toSet());
+
+ return new DetectorEvaluationOptions(forceNestedSearch, getFollowSymLinks(), (rule -> includedTypes.contains(rule.getDetectorType())));
}
public BdioOptions createBdioOptions() {
@@ -461,6 +465,7 @@ public class DetectConfigurationFactory {
return getPathOrNull(property.getProperty());
}
+ // TODO: Make these path methods more accessible to DetectableOptionFactory. Maybe on DetectConfiguration
private Path getPathOrNull(NullablePathProperty property) {
return detectConfiguration.getValue(property).map(path -> path.resolvePath(pathResolver)).orElse(null);
}
