edu.umd.cs.findbugs

Interface IFindBugsEngine

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 Summary
voidaddClassObserver(IClassObserver classObserver)
Add an IClassObserver.
voidaddFilter(String filterFileName, boolean include)
Set filter of bug instances to include or exclude.
booleanemitTrainingOutput()
Return whether or not training output should be emitted after analysis completes.
voidenableTrainingInput(String trainingInputDir)
Set whether or not training input should be used to make the analysis more precise.
voidenableTrainingOutput(String trainingOutputDir)
Set whether or not training output should be emitted.
voidexecute()
Execute FindBugs on the Project.
intgetBugCount()
Get the number of bug instances that were reported during analysis.
BugReportergetBugReporter()
Get the BugReporter.
StringgetCurrentClass()
Get the name of the most recent class to be analyzed.
intgetErrorCount()
Get the number of errors that occurred during analysis.
intgetMissingClassCount()
Get the number of time missing classes were reported during analysis.
ProjectgetProject()
Get the Project.
StringgetProjectName()
StringgetReleaseName()
StringgetTrainingInputDir()
Get the training input database directory.
StringgetTrainingOutputDir()
Get the training output directory.
UserPreferencesgetUserPreferences()
Get the UserPreferences.
voidsetAbridgedMessages(boolean xmlWithAbridgedMessages)
voidsetAnalysisFeatureSettings(AnalysisFeatureSetting[] settingList)
Set analysis feature settings.
voidsetBugReporter(BugReporter bugReporter)
Set the BugReporter.
voidsetClassScreener(IClassScreener classScreener)
Set the ClassScreener.
voidsetDetectorFactoryCollection(DetectorFactoryCollection detectorFactoryCollection)
Set the DetectorFactoryCollection from which plugins/detectors may be accessed.
voidsetProgressCallback(FindBugsProgress progressCallback)
Set the progress callback that will be used to keep track of the progress of the analysis.
voidsetProject(Project project)
Set the Project.
voidsetProjectName(String projectName)
voidsetRelaxedReportingMode(boolean relaxedReportingMode)
Set relaxed reporting mode.
voidsetReleaseName(String releaseName)
voidsetScanNestedArchives(boolean scanNestedArchives)
Set whether or not nested archives should be scanned.
voidsetSourceInfoFile(String sourceInfoFile)
Set the filename of the source info file containing line numbers for fields and classes.
voidsetUserPreferences(UserPreferences userPreferences)
Set the UserPreferences representing which Detectors should be used.
booleanuseTrainingInput()
Return whether or not we should make use of training data.

Method Detail

addClassObserver

public void addClassObserver(IClassObserver classObserver)
Add an IClassObserver.

Parameters: classObserver the IClassObserver

addFilter

public void addFilter(String filterFileName, boolean include)
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

emitTrainingOutput

public 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

enableTrainingInput

public 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

enableTrainingOutput

public void enableTrainingOutput(String trainingOutputDir)
Set whether or not training output should be emitted.

Parameters: trainingOutputDir directory to save training output in

execute

public void execute()
Execute FindBugs on the Project. All bugs found are reported to the BugReporter object which was set when this object was constructed.

Throws: java.io.IOException if an I/O exception occurs analyzing one of the files InterruptedException if the thread is interrupted while conducting the analysis CheckedAnalysisException if a fatal exception occurs

getBugCount

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

getBugReporter

public BugReporter getBugReporter()
Get the BugReporter.

Returns: the BugReporter

getCurrentClass

public 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.

getErrorCount

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

getMissingClassCount

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

getProject

public Project getProject()
Get the Project.

Returns: the Project

getProjectName

public String getProjectName()

Returns: Returns the projectName.

getReleaseName

public String getReleaseName()

Returns: Returns the releaseName.

getTrainingInputDir

public String getTrainingInputDir()
Get the training input database directory.

Returns: the training input database directory

getTrainingOutputDir

public String getTrainingOutputDir()
Get the training output directory.

Returns: the training output directory

getUserPreferences

public UserPreferences getUserPreferences()
Get the UserPreferences.

Returns: the UserPreferences

setAbridgedMessages

public void setAbridgedMessages(boolean xmlWithAbridgedMessages)

Parameters: xmlWithAbridgedMessages

setAnalysisFeatureSettings

public void setAnalysisFeatureSettings(AnalysisFeatureSetting[] settingList)
Set analysis feature settings.

Parameters: settingList list of analysis feature settings

setBugReporter

public void setBugReporter(BugReporter bugReporter)
Set the BugReporter.

Parameters: bugReporter The BugReporter to set

setClassScreener

public 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

setDetectorFactoryCollection

public void setDetectorFactoryCollection(DetectorFactoryCollection detectorFactoryCollection)
Set the DetectorFactoryCollection from which plugins/detectors may be accessed.

Parameters: detectorFactoryCollection the DetectorFactoryCollection

setProgressCallback

public 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

setProject

public void setProject(Project project)
Set the Project.

Parameters: project The Project to set

setProjectName

public void setProjectName(String projectName)

Parameters: projectName The project name to set.

setRelaxedReportingMode

public void setRelaxedReportingMode(boolean relaxedReportingMode)
Set relaxed reporting mode.

Parameters: relaxedReportingMode true if relaxed reporting mode should be enabled, false if not

setReleaseName

public void setReleaseName(String releaseName)

Parameters: releaseName The releaseName to set.

setScanNestedArchives

public 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

setSourceInfoFile

public 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

setUserPreferences

public 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

useTrainingInput

public boolean useTrainingInput()
Return whether or not we should make use of training data.

Returns: true if training data should be used, false if not

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.