Interface IFindBugsEngine

All Known Implementing Classes:
FindBugs2

public interface IFindBugsEngine
Interface for a FindBugs engine class. An instance of this interface takes a project, user configuration options, orchestrates the analysis of the classes in the project, and reports the results to the configured BugReporter.
Author:
David Hovemeyer
  • Method Details

    • getBugReporter

      BugReporter getBugReporter()
      Get the BugReporter.
      Returns:
      the BugReporter
    • setBugReporter

      void setBugReporter(BugReporter bugReporter)
      Set the BugReporter.
      Parameters:
      bugReporter - The BugReporter to set
    • setProject

      void setProject(Project project)
      Set the Project.
      Parameters:
      project - The Project to set
    • getProject

      Project getProject()
      Get the Project.
      Returns:
      the Project
    • setProgressCallback

      void setProgressCallback(FindBugsProgress progressCallback)
      Set the progress callback that will be used to keep track of the progress of the analysis.
      Parameters:
      progressCallback - the progress callback
    • addFilter

      void addFilter(String filterFileName, boolean include) throws IOException, FilterException
      Set filter of bug instances to include or exclude.
      Parameters:
      filterFileName - the name of the filter file
      include - true if the filter specifies bug instances to include, false if it specifies bug instances to exclude
      Throws:
      IOException
      FilterException
    • excludeBaselineBugs

      void excludeBaselineBugs(String baselineBugs) throws IOException, org.dom4j.DocumentException
      Provide baseline of bugs not to report
      Parameters:
      baselineBugs - the name of the xml bug baseline file
      Throws:
      org.dom4j.DocumentException
      IOException
    • setUserPreferences

      void setUserPreferences(UserPreferences userPreferences)
      Set the UserPreferences representing which Detectors should be used. If UserPreferences are not set explicitly, the default set of Detectors will be used.
      Parameters:
      userPreferences - the UserPreferences
    • addClassObserver

      void addClassObserver(IClassObserver classObserver)
      Add an IClassObserver.
      Parameters:
      classObserver - the IClassObserver
    • setClassScreener

      void setClassScreener(IClassScreener classScreener)
      Set the ClassScreener. This object chooses which individual classes to analyze. By default, all classes are analyzed.
      Parameters:
      classScreener - the ClassScreener to use
    • setRelaxedReportingMode

      void setRelaxedReportingMode(boolean relaxedReportingMode)
      Set relaxed reporting mode.
      Parameters:
      relaxedReportingMode - true if relaxed reporting mode should be enabled, false if not
    • enableTrainingOutput

      void enableTrainingOutput(String trainingOutputDir)
      Set whether or not training output should be emitted.
      Parameters:
      trainingOutputDir - directory to save training output in
    • enableTrainingInput

      void enableTrainingInput(String trainingInputDir)
      Set whether or not training input should be used to make the analysis more precise.
      Parameters:
      trainingInputDir - directory to load training input from
    • setAnalysisFeatureSettings

      void setAnalysisFeatureSettings(AnalysisFeatureSetting[] settingList)
      Set analysis feature settings.
      Parameters:
      settingList - list of analysis feature settings
    • getReleaseName

      String getReleaseName()
      Returns:
      Returns the releaseName.
    • setReleaseName

      void setReleaseName(String releaseName)
      Parameters:
      releaseName - The releaseName to set.
    • getProjectName

      String getProjectName()
      Returns:
      Returns the projectName.
    • setProjectName

      void setProjectName(String projectName)
      Parameters:
      projectName - The project name to set.
    • setSourceInfoFile

      void setSourceInfoFile(String sourceInfoFile)
      Set the filename of the source info file containing line numbers for fields and classes.
      Parameters:
      sourceInfoFile - the source info filename
    • execute

      void execute() throws IOException, InterruptedException
      Execute FindBugs on the Project. All bugs found are reported to the BugReporter object which was set when this object was constructed.
      Throws:
      IOException - if an I/O exception occurs analyzing one of the files
      InterruptedException - if the thread is interrupted while conducting the analysis
    • getCurrentClass

      String getCurrentClass()
      Get the name of the most recent class to be analyzed. This is useful for diagnosing an unexpected exception. Returns null if no class has been analyzed.
    • getBugCount

      int getBugCount()
      Get the number of bug instances that were reported during analysis.
    • getErrorCount

      int getErrorCount()
      Get the number of errors that occurred during analysis.
    • getMissingClassCount

      int getMissingClassCount()
      Get the number of time missing classes were reported during analysis.
    • getUserPreferences

      UserPreferences getUserPreferences()
      Get the UserPreferences.
      Returns:
      the UserPreferences
    • emitTrainingOutput

      boolean emitTrainingOutput()
      Return whether or not training output should be emitted after analysis completes.
      Returns:
      true if training output should be emitted, false if not
    • getTrainingOutputDir

      String getTrainingOutputDir()
      Get the training output directory.
      Returns:
      the training output directory
    • useTrainingInput

      boolean useTrainingInput()
      Return whether or not we should make use of training data.
      Returns:
      true if training data should be used, false if not
    • getTrainingInputDir

      String getTrainingInputDir()
      Get the training input database directory.
      Returns:
      the training input database directory
    • setScanNestedArchives

      void setScanNestedArchives(boolean scanNestedArchives)
      Set whether or not nested archives should be scanned.
      Parameters:
      scanNestedArchives - true if nested archives should be scanned, false if not
    • setNoClassOk

      void setNoClassOk(boolean noClassOk)
      Set whether or not to generate an empty output file if there were no class files specified.
      Parameters:
      noClassOk - true if FindBugs should generate empty output file
    • setDetectorFactoryCollection

      void setDetectorFactoryCollection(DetectorFactoryCollection detectorFactoryCollection)
      Set the DetectorFactoryCollection from which plugins/detectors may be accessed.
      Parameters:
      detectorFactoryCollection - the DetectorFactoryCollection
    • setAbridgedMessages

      void setAbridgedMessages(boolean xmlWithAbridgedMessages)
      Parameters:
      xmlWithAbridgedMessages -
    • setMergeSimilarWarnings

      void setMergeSimilarWarnings(boolean mergeSimilarWarnings)
    • setApplySuppression

      void setApplySuppression(boolean applySuppression)
    • finishSettings

      void finishSettings()
    • setRankThreshold

      void setRankThreshold(int rankThreshold)
    • setBugReporterDecorators

      void setBugReporterDecorators(Set<String> explicitlyEnabled, Set<String> explicitlyDisabled)