use of com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult in project hub-detect by blackducksoftware.
the class CpanCliDetector method extractable.
@Override
public DetectorResult extractable() throws DetectorException {
final File cpan = cacheableExecutableFinder.getExecutable(CacheableExecutableType.CPAN);
if (cpan == null) {
return new ExecutableNotFoundDetectorResult("cpan");
} else {
cpanExe = cpan;
}
final File cpanm = cacheableExecutableFinder.getExecutable(CacheableExecutableType.CPANM);
if (cpanm == null) {
return new ExecutableNotFoundDetectorResult("cpanm");
} else {
cpanmExe = cpanm;
}
return new PassedDetectorResult();
}
use of com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult in project hub-detect by blackducksoftware.
the class GoVendorDetector method applicable.
@Override
public DetectorResult applicable() {
File vendorDir = fileFinder.findFile(environment.getDirectory(), VENDOR_JSON_DIRNAME);
if (vendorDir == null) {
logger.trace(String.format("Dir %s not found", VENDOR_JSON_DIRNAME));
return new FileNotFoundDetectorResult(VENDOR_JSON_FILENAME);
}
vendorJson = fileFinder.findFile(vendorDir, VENDOR_JSON_FILENAME);
if (vendorJson == null) {
logger.trace(String.format("File %s not found", VENDOR_JSON_FILENAME));
return new FileNotFoundDetectorResult(VENDOR_JSON_FILENAME);
}
logger.trace(String.format("%s/%s found", VENDOR_JSON_DIRNAME, VENDOR_JSON_FILENAME));
return new PassedDetectorResult();
}
use of com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult in project hub-detect by blackducksoftware.
the class DetectorSearchEvaluator method searchable.
public DetectorResult searchable(final DetectorSearchRule searchRules, final List<Detector> appliedSoFar, DetectorEnvironment environment) {
Detector detector = searchRules.getDetector();
final DetectorType detectorType = detector.getDetectorType();
if (!environment.getDetectorFilter().shouldInclude(detectorType.toString())) {
return new ExcludedDetectorResult();
}
final int maxDepth = searchRules.getMaxDepth();
if (environment.getDepth() > maxDepth) {
return new MaxDepthExceededDetectorResult(environment.getDepth(), maxDepth);
}
final Set<Detector> yieldTo = appliedSoFar.stream().filter(it -> searchRules.getYieldsTo().contains(it)).collect(Collectors.toSet());
if (yieldTo.size() > 0) {
return new YieldedDetectorResult(yieldTo);
}
final boolean nestable = searchRules.isNestable();
if (environment.getForceNestedSearch()) {
return new ForcedNestedPassedDetectorResult();
} else if (nestable) {
if (environment.getAppliedToParent().stream().anyMatch(applied -> applied.isSame(detector))) {
return new NotSelfNestableDetectorResult();
}
} else if (!nestable && environment.getAppliedToParent().size() > 0) {
return new NotNestableDetectorResult();
}
return new PassedDetectorResult();
}
use of com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult in project hub-detect by blackducksoftware.
the class NpmCliDetector method applicable.
@Override
public DetectorResult applicable() {
final File packageJson = fileFinder.findFile(environment.getDirectory(), PACKAGE_JSON);
if (packageJson == null) {
return new FileNotFoundDetectorResult(PACKAGE_JSON);
}
addRelevantDiagnosticFile(packageJson);
return new PassedDetectorResult();
}
use of com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult in project hub-detect by blackducksoftware.
the class NpmCliDetector method extractable.
@Override
public DetectorResult extractable() throws DetectorException {
final File nodeModules = fileFinder.findFile(environment.getDirectory(), NODE_MODULES);
if (nodeModules == null) {
return new NpmRunInstallDetectorResult(environment.getDirectory().getAbsolutePath());
}
npmExe = npmExecutableFinder.findNpm(environment);
if (npmExe == null) {
return new ExecutableNotFoundDetectorResult("npm");
}
return new PassedDetectorResult();
}
Aggregations