Search in sources :

Example 6 with PassedDetectorResult

use of com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult in project hub-detect by blackducksoftware.

the class NpmPackageLockDetector method applicable.

@Override
public DetectorResult applicable() {
    lockfile = fileFinder.findFile(environment.getDirectory(), PACKAGE_LOCK_JSON);
    if (lockfile == null) {
        return new FileNotFoundDetectorResult(PACKAGE_LOCK_JSON);
    }
    File foundPackageJson = fileFinder.findFile(environment.getDirectory(), PACKAGE_JSON);
    if (foundPackageJson == null) {
        logger.warn("Npm applied but it could not find a package.json so dependencies may not be entirely accurate.");
    } else {
        packageJson = Optional.of(foundPackageJson);
    }
    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 7 with PassedDetectorResult

use of com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult in project hub-detect by blackducksoftware.

the class NpmShrinkwrapDetector method applicable.

@Override
public DetectorResult applicable() {
    lockfile = fileFinder.findFile(environment.getDirectory(), SHRINKWRAP_JSON);
    if (lockfile == null) {
        return new FileNotFoundDetectorResult(SHRINKWRAP_JSON);
    }
    File foundPackageJson = fileFinder.findFile(environment.getDirectory(), PACKAGE_JSON);
    if (foundPackageJson == null) {
        logger.warn("Npm applied but it could not find a package.json so dependencies may not be entirely accurate.");
    } else {
        packageJson = Optional.of(foundPackageJson);
    }
    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)

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