Search in sources :

Example 1 with ExclusionPatternCreator

use of com.blackducksoftware.integration.hub.detect.workflow.hub.ExclusionPatternCreator in project hub-detect by blackducksoftware.

the class BlackDuckSignatureScanner method createScanPath.

private SignatureScanPath createScanPath(final String path, Integer maxDepth, final String[] hubSignatureScannerExclusionNamePatterns, final String[] providedExclusionPatterns) throws IntegrationException {
    try {
        final File target = new File(path);
        final String targetPath = target.getCanonicalPath();
        final ExclusionPatternCreator exclusionPatternCreator = new ExclusionPatternCreator(detectFileFinder, target);
        final String maxDepthHitMsg = String.format("Maximum depth %d hit while traversing source tree to generate signature scanner exclusion patterns. To search deeper, adjust the value of property %s", maxDepth, DetectProperty.DETECT_BLACKDUCK_SIGNATURE_SCANNER_EXCLUSION_PATTERN_SEARCH_DEPTH.getPropertyName());
        final Set<String> scanExclusionPatterns = exclusionPatternCreator.determineExclusionPatterns(maxDepthHitMsg, maxDepth, hubSignatureScannerExclusionNamePatterns);
        if (null != providedExclusionPatterns) {
            for (final String providedExclusionPattern : providedExclusionPatterns) {
                scanExclusionPatterns.add(providedExclusionPattern);
            }
        }
        SignatureScanPath signatureScanPath = new SignatureScanPath();
        signatureScanPath.targetPath = targetPath;
        signatureScanPath.exclusions.addAll(scanExclusionPatterns);
        return signatureScanPath;
    } catch (final IOException e) {
        throw new IntegrationException(e.getMessage(), e);
    }
}
Also used : IntegrationException(com.synopsys.integration.exception.IntegrationException) IOException(java.io.IOException) File(java.io.File) ExclusionPatternCreator(com.blackducksoftware.integration.hub.detect.workflow.hub.ExclusionPatternCreator)

Aggregations

ExclusionPatternCreator (com.blackducksoftware.integration.hub.detect.workflow.hub.ExclusionPatternCreator)1 IntegrationException (com.synopsys.integration.exception.IntegrationException)1 File (java.io.File)1 IOException (java.io.IOException)1