@Override
    protected void analyzeDependency(Dependency dependency, Engine engine)
            throws AnalysisException {
        if (needToDisableGemspecAnalyzer) {
            boolean failed = true;
            final String className = RubyGemspecAnalyzer.class.getName();
            for (FileTypeAnalyzer analyzer : engine.getFileTypeAnalyzers()) {
                if (analyzer instanceof RubyBundlerAnalyzer) {
                    ((RubyBundlerAnalyzer) analyzer).setEnabled(false);
                    LOGGER.info("Disabled {} to avoid noisy duplicate results.", RubyBundlerAnalyzer.class.getName());
                } else if (analyzer instanceof RubyGemspecAnalyzer) {
                    ((RubyGemspecAnalyzer) analyzer).setEnabled(false);
                    LOGGER.info("Disabled {} to avoid noisy duplicate results.", className);
                    failed = false;
                }
            }
            if (failed) {
                LOGGER.warn("Did not find {}.", className);
            }
            needToDisableGemspecAnalyzer = false;
        }
        final File parentFile = dependency.getActualFile().getParentFile();
        final Process process = launchBundleAudit(parentFile);
        final int exitValue;
        try {
            exitValue = process.waitFor();
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
            throw new AnalysisException("bundle-audit process interrupted", ie);
        }
        if (exitValue < 0 || exitValue > 1) {
            final String msg = String.format("Unexpected exit code from bundle-audit process; exit code: %s", exitValue);
            throw new AnalysisException(msg);
        }
        try {
            try (BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8))) {
                while (errReader.ready()) {
                    final String error = errReader.readLine();
                    LOGGER.warn(error);
                }
            }
            try (BufferedReader rdr = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
                processBundlerAuditOutput(dependency, engine, rdr);
            }
        } catch (IOException | CpeValidationException ioe) {
            LOGGER.warn("bundle-audit failure", ioe);
        }
    }
@ Override protected void analyzeDependency ( Dependency dependency , Engine engine ) throws AnalysisException { if ( needToDisableGemspecAnalyzer ) { boolean failed = true ; final String className = RubyGemspecAnalyzer . class . getName ( ) ; for ( FileTypeAnalyzer analyzer : engine . getFileTypeAnalyzers ( ) ) { if ( analyzer instanceof RubyBundlerAnalyzer ) { ( ( RubyBundlerAnalyzer ) analyzer ) . setEnabled ( false ) ; LOGGER . info ( "Disabled {} to avoid noisy duplicate results." , RubyBundlerAnalyzer . class . getName ( ) ) ; } else if ( analyzer instanceof RubyGemspecAnalyzer ) { ( ( RubyGemspecAnalyzer ) analyzer ) . setEnabled ( false ) ; LOGGER . info ( "Disabled {} to avoid noisy duplicate results." , className ) ; failed = false ; } } if ( failed ) { LOGGER . warn ( "Did not find {}." , className ) ; } needToDisableGemspecAnalyzer = false ; } final File parentFile = dependency . getActualFile ( ) . getParentFile ( ) ; final Process process = launchBundleAudit ( parentFile ) ; final int exitValue ; try { exitValue = process . waitFor ( ) ; } catch ( InterruptedException ie ) { Thread . currentThread ( ) . interrupt ( ) ; throw new AnalysisException ( "bundle-audit process interrupted" , ie ) ; } if ( exitValue < 0 || exitValue > 1 ) { final String msg = String . format ( "Unexpected exit code from bundle-audit process; exit code: %s" , exitValue ) ; throw new AnalysisException ( msg ) ; } try { try ( BufferedReader errReader = new BufferedReader ( new InputStreamReader ( process . getErrorStream ( ) , StandardCharsets . UTF_8 ) ) ) { while ( errReader . ready ( ) ) { final String error = errReader . readLine ( ) ; LOGGER . warn ( error ) ; } } try ( BufferedReader rdr = new BufferedReader ( new InputStreamReader ( process . getInputStream ( ) , StandardCharsets . UTF_8 ) ) ) { processBundlerAuditOutput ( dependency , engine , rdr ) ; } } catch ( IOException | CpeValidationException ioe ) { LOGGER . warn ( "bundle-audit failure" , ioe ) ; } }
Determines if the analyzer can analyze the given file type.

@param dependency the dependency to determine if it can analyze
@param engine the dependency-check engine
@throws AnalysisException thrown if there is an analysis exception.