Determines if the analyzer can analyze the given dependency.

@return whether or not the analyzer can analyze the dependency
488663
protected boolean shouldAnalyze() {
        if (analyzer instanceof FileTypeAnalyzer) {
            final FileTypeAnalyzer fileTypeAnalyzer = (FileTypeAnalyzer) analyzer;
            return fileTypeAnalyzer.accept(dependency.getActualFile());
        }
        return true;
    }
1196870
function canInitialize(dependencies, initialized) {
  return !dependencies || 
    dependencies.length === 0 || 
    dependencies.every(function (name) {
      return !!initialized[name];
    });
}
405855
@Override
    public boolean accepts(Dependency d) {
        if (d.getOrigin().equals(d.getTarget()))
            return false;

        // filter same package dependency
        String pn = d.getTarget().getPackageName();
        if (filterSamePackage && d.getOrigin().getPackageName().equals(pn)) {
            return false;
        }

        // filter if the target package matches the given filter
        if (filterPattern != null && filterPattern.matcher(pn).matches()) {
            return false;
        }

        // filter if the target matches the given filtered package name or regex
        return filter != null ? filter.accepts(d) : true;
    }
814954
public <T> boolean isDependentScopedStrict(final Class<T> type) {
        Bean<T> bean = resolveStrict(manager, type);
        if (bean != null) {
            return Dependent.class.equals(bean.getScope());
        }
        return false;
    }
572981
def check_dependency(self, dependency_path):
        """"""
        stored_hash = self._stamp_file_hashes.get(dependency_path)

        # This file was newly added, or we don't have a file
        # with stored hashes yet. Assume out of date.
        if not stored_hash:
            return False

        return stored_hash == _sha1_for_file(dependency_path)
74925
@Override
   public boolean accept(Dependency dependency)
   {
      for (Predicate<Dependency> filter : filters)
      {
         if (!filter.accept(dependency))
         {
            return false;
         }
      }
      return true;
   }
878485
@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);
        }
    }
660916
@Override
    public ClassInfo analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor) throws CheckedAnalysisException {

        if (descriptor instanceof ClassInfo) {
            return (ClassInfo) descriptor;
        }
        ClassData classData;
        try {
            classData = analysisCache.getClassAnalysis(ClassData.class, descriptor);
        } catch (edu.umd.cs.findbugs.classfile.MissingClassException e) {
            if (!"package-info".equals(descriptor.getSimpleName())) {
                throw e;
            }

            ClassInfo.Builder builder = new ClassInfo.Builder();
            builder.setClassDescriptor(descriptor);
            builder.setAccessFlags(1536);
            return builder.build();
        }

        // Read the class info

        FBClassReader reader = analysisCache.getClassAnalysis(FBClassReader.class, descriptor);
        ClassParserInterface parser = new ClassParserUsingASM(reader, descriptor, classData.getCodeBaseEntry());

        ClassInfo.Builder classInfoBuilder = new ClassInfo.Builder();
        parser.parse(classInfoBuilder);
        ClassInfo classInfo = classInfoBuilder.build();

        if (!classInfo.getClassDescriptor().equals(descriptor)) {
            throw new ClassNameMismatchException(descriptor, classInfo.getClassDescriptor(), classData.getCodeBaseEntry());
        }
        return classInfo;
    }
715079
@Override
    public ClassContext analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor) throws CheckedAnalysisException {

        JavaClass javaClass = analysisCache.getClassAnalysis(JavaClass.class, descriptor);
        ClassContext classContext = new ClassContext(javaClass, AnalysisContext.currentAnalysisContext());
        return classContext;
    }
1113730
public boolean isModified()
  {
    synchronized (this) {
      if (_isChecking || _isModified) {
        return _isModified;
      }

      _isChecking = true;
    }

    try {
      long now;

      now = CurrentTime.currentTime();

      if (now < _lastCheckTime + _checkInterval)
        return _isModified;

      _lastCheckTime = now;

      for (int i = _dependencyList.size() - 1; i >= 0; i--) {
        Dependency dependency = _dependencyList.get(i);

        if (dependency.isModified()) {
          dependency.logModified(log());

          _isModified = true;

          return _isModified;
        }
      }

      // _isModified = false;

      return _isModified;
    } finally {
      _isChecking = false;
    }
  }
488909
@Override
    public boolean isEligibleFor(Object criterion) {
        return Class.class.isInstance(criterion)
            && ((Class<?>) criterion).isAssignableFrom(getClass());
    }
649988
@Override
    public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
        for (Evidence e : dependency.getEvidence(EvidenceType.VENDOR)) {
            if ("pom".equals(e.getSource())) {
                return;
            }
        }
        try {
            final List<MavenArtifact> mas = fetchMavenArtifacts(dependency);
            final Confidence confidence = mas.size() > 1 ? Confidence.HIGH : Confidence.HIGHEST;
            for (MavenArtifact ma : mas) {
                LOGGER.debug("Central analyzer found artifact ({}) for dependency ({})", ma, dependency.getFileName());
                dependency.addAsEvidence("central", ma, confidence);

                if (ma.getPomUrl() != null) {
                    File pomFile = null;
                    try {
                        final File baseDir = getSettings().getTempDirectory();
                        pomFile = File.createTempFile("pom", ".xml", baseDir);
                        if (!pomFile.delete()) {
                            LOGGER.warn("Unable to fetch pom.xml for {} from Central; "
                                    + "this could result in undetected CPE/CVEs.", dependency.getFileName());
                            LOGGER.debug("Unable to delete temp file");
                        }
                        LOGGER.debug("Downloading {}", ma.getPomUrl());
                        final Downloader downloader = new Downloader(getSettings());
                        final int maxAttempts = this.getSettings().getInt(Settings.KEYS.ANALYZER_CENTRAL_RETRY_COUNT, 3);
                        int retryCount = 0;
                        long sleepingTimeBetweenRetriesInMillis = BASE_RETRY_WAIT;
                        boolean success = false;
                        do {
                            //CSOFF: NestedTryDepth
                            try {
                                downloader.fetchFile(new URL(ma.getPomUrl()), pomFile);
                                success = true;
                            } catch (DownloadFailedException ex) {
                                try {
                                    Thread.sleep(sleepingTimeBetweenRetriesInMillis);
                                    sleepingTimeBetweenRetriesInMillis *= 2;
                                } catch (InterruptedException ex1) {
                                    throw new UnexpectedAnalysisException(ex1);
                                }
                            }
                            //CSON: NestedTryDepth
                        } while (!success && retryCount++ < maxAttempts);
                        if (success) {
                            PomUtils.analyzePOM(dependency, pomFile);
                        } else {
                            LOGGER.warn("Unable to download pom.xml for {} from Central; "
                                    + "this could result in undetected CPE/CVEs.", dependency.getFileName());
                        }

                    } catch (AnalysisException ex) {
                        LOGGER.warn(MessageFormat.format("Unable to analyze pom.xml for {0} from Central; "
                                + "this could result in undetected CPE/CVEs.", dependency.getFileName()), ex);

                    } finally {
                        if (pomFile != null && pomFile.exists() && !FileUtils.deleteQuietly(pomFile)) {
                            LOGGER.debug("Failed to delete temporary pom file {}", pomFile.toString());
                            pomFile.deleteOnExit();
                        }
                    }
                }
            }
        } catch (IllegalArgumentException iae) {
            LOGGER.info("invalid sha1-hash on {}", dependency.getFileName());
        } catch (FileNotFoundException fnfe) {
            LOGGER.debug("Artifact not found in repository: '{}", dependency.getFileName());
        } catch (IOException ioe) {
            final String message = "Could not connect to Central search. Analysis failed.";
            LOGGER.error(message, ioe);
            throw new AnalysisException(message, ioe);
        }
    }
1158748
protected function validateAnalyzers()
    {
        foreach ($this->analyzers as $analyzer) {
            if ($analyzer->getType() === '') {
                throw new BuildException('Analyzer missing required "type" attribute');
            }

            if (count($analyzer->getValue()) === 0) {
                throw new BuildException('Analyzer missing required "value" attribute');
            }
        }
    }
387227
protected boolean addDependencies(DependencyContainer container)
  {
    /* XXX:
    if (_classPath instanceof JarPath) {
      container.add(_depend);
      return false;
    }
    else
    */ 
    if (_hasJNIReload) {
      container.add(this);
      return true;
    }
    else if (_sourcePath == null) {
      container.add(_depend);
      return false;
    }
    else {
      container.add(this);
      return true;
    }
  }
188704
private boolean isFirstAnalysisSecondaryLongLivingBranch() {
    if (analysisMetadataHolder.isFirstAnalysis()) {
      Branch branch = analysisMetadataHolder.getBranch();
      return !branch.isMain() && branch.getType() == BranchType.LONG;
    }
    return false;
  }
141658
@Override
    public UnpackedCode analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
        Method method = getMethod(analysisCache, descriptor);
        Code code = method.getCode();
        if (code == null) {
            return null;
        }

        byte[] instructionList = code.getCode();

        // Create callback
        UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length);

        // Scan the method.
        BytecodeScanner scanner = new BytecodeScanner();
        scanner.scan(instructionList, callback);

        return callback.getUnpackedCode();

    }
322176
def has_resolved_dependencies(self):
        """"""
        for dependency in self.dependencies:
            if dependency.state != Task.State.DONE:
                return False

        return True