private Process launchBundleAudit ( File folder ) throws AnalysisException { if ( ! folder . isDirectory ( ) ) { throw new AnalysisException ( String . format ( "%s should have been a directory." , folder . getAbsolutePath ( ) ) ) ; } final List < String > args = new ArrayList <> ( ) ; final String bundleAuditPath = getSettings ( ) . getString ( Settings . KEYS . ANALYZER_BUNDLE_AUDIT_PATH ) ; File bundleAudit = null ; if ( bundleAuditPath != null ) { bundleAudit = new File ( bundleAuditPath ) ; if ( ! bundleAudit . isFile ( ) ) { LOGGER . warn ( "Supplied `bundleAudit` path is incorrect: {}" , bundleAuditPath ) ; bundleAudit = null ; } } args . add ( bundleAudit != null && bundleAudit . isFile ( ) ? bundleAudit . getAbsolutePath ( ) : "bundle-audit" ) ; args . add ( "check" ) ; args . add ( "--verbose" ) ; final ProcessBuilder builder = new ProcessBuilder ( args ) ; builder . directory ( folder ) ; try { LOGGER . info ( "Launching: {} from {}" , args , folder ) ; return builder . start ( ) ; } catch ( IOException ioe ) { throw new AnalysisException ( "bundle-audit initialization failure; this error can be ignored if you are not analyzing Ruby. " + "Otherwise ensure that bundle-audit is installed and the path to bundle audit is correctly specified" , ioe ) ; } }
Launch bundle - audit .