Search in sources :

Example 1 with PassedDetectorResult

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();
}
Also used : PassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult) ExecutableNotFoundDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.ExecutableNotFoundDetectorResult) File(java.io.File)

Example 2 with 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();
}
Also used : PassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult) FileNotFoundDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult) File(java.io.File)

Example 3 with 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();
}
Also used : Detector(com.blackducksoftware.integration.hub.detect.detector.Detector) DetectorType(com.blackducksoftware.integration.hub.detect.detector.DetectorType) NotNestableDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.NotNestableDetectorResult) DetectorEvaluation(com.blackducksoftware.integration.hub.detect.workflow.search.result.DetectorEvaluation) Set(java.util.Set) EventSystem(com.blackducksoftware.integration.hub.detect.workflow.event.EventSystem) NotSelfNestableDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.NotSelfNestableDetectorResult) Collectors(java.util.stream.Collectors) ForcedNestedPassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.ForcedNestedPassedDetectorResult) ArrayList(java.util.ArrayList) DetectorEnvironment(com.blackducksoftware.integration.hub.detect.detector.DetectorEnvironment) PassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult) List(java.util.List) Event(com.blackducksoftware.integration.hub.detect.workflow.event.Event) DetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.DetectorResult) MaxDepthExceededDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.MaxDepthExceededDetectorResult) ExcludedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.ExcludedDetectorResult) YieldedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.YieldedDetectorResult) YieldedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.YieldedDetectorResult) ForcedNestedPassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.ForcedNestedPassedDetectorResult) PassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult) DetectorType(com.blackducksoftware.integration.hub.detect.detector.DetectorType) MaxDepthExceededDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.MaxDepthExceededDetectorResult) NotSelfNestableDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.NotSelfNestableDetectorResult) Detector(com.blackducksoftware.integration.hub.detect.detector.Detector) ForcedNestedPassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.ForcedNestedPassedDetectorResult) NotNestableDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.NotNestableDetectorResult) ExcludedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.ExcludedDetectorResult)

Example 4 with 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();
}
Also used : PassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult) FileNotFoundDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult) File(java.io.File)

Example 5 with 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();
}
Also used : PassedDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult) NpmRunInstallDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.NpmRunInstallDetectorResult) ExecutableNotFoundDetectorResult(com.blackducksoftware.integration.hub.detect.workflow.search.result.ExecutableNotFoundDetectorResult) File(java.io.File)

Aggregations

PassedDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult)7 File (java.io.File)6 FileNotFoundDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult)4 ExecutableNotFoundDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.ExecutableNotFoundDetectorResult)2 Detector (com.blackducksoftware.integration.hub.detect.detector.Detector)1 DetectorEnvironment (com.blackducksoftware.integration.hub.detect.detector.DetectorEnvironment)1 DetectorType (com.blackducksoftware.integration.hub.detect.detector.DetectorType)1 Event (com.blackducksoftware.integration.hub.detect.workflow.event.Event)1 EventSystem (com.blackducksoftware.integration.hub.detect.workflow.event.EventSystem)1 DetectorEvaluation (com.blackducksoftware.integration.hub.detect.workflow.search.result.DetectorEvaluation)1 DetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.DetectorResult)1 ExcludedDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.ExcludedDetectorResult)1 ForcedNestedPassedDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.ForcedNestedPassedDetectorResult)1 MaxDepthExceededDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.MaxDepthExceededDetectorResult)1 NotNestableDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.NotNestableDetectorResult)1 NotSelfNestableDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.NotSelfNestableDetectorResult)1 NpmRunInstallDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.NpmRunInstallDetectorResult)1 YieldedDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.YieldedDetectorResult)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1