Search in sources :

Example 1 with FileNotFoundDetectorResult

use of com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult 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 2 with FileNotFoundDetectorResult

use of com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult 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 3 with FileNotFoundDetectorResult

use of com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult 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 4 with FileNotFoundDetectorResult

use of com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult 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

FileNotFoundDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.FileNotFoundDetectorResult)4 PassedDetectorResult (com.blackducksoftware.integration.hub.detect.workflow.search.result.PassedDetectorResult)4 File (java.io.File)4