Package edu.umd.cs.findbugs
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 Summary
Modifier and TypeMethodDescriptionvoid
addClassObserver
(IClassObserver classObserver) Add an IClassObserver.void
Set filter of bug instances to include or exclude.boolean
Return whether or not training output should be emitted after analysis completes.void
enableTrainingInput
(String trainingInputDir) Set whether or not training input should be used to make the analysis more precise.void
enableTrainingOutput
(String trainingOutputDir) Set whether or not training output should be emitted.void
excludeBaselineBugs
(String baselineBugs) Provide baseline of bugs not to reportvoid
execute()
Execute FindBugs on the Project.void
int
Get the number of bug instances that were reported during analysis.Get the BugReporter.Get the name of the most recent class to be analyzed.int
Get the number of errors that occurred during analysis.int
Get the number of time missing classes were reported during analysis.Get the Project.Get the training input database directory.Get the training output directory.Get the UserPreferences.void
setAbridgedMessages
(boolean xmlWithAbridgedMessages) void
setAnalysisFeatureSettings
(AnalysisFeatureSetting[] settingList) Set analysis feature settings.void
setApplySuppression
(boolean applySuppression) void
setBugReporter
(BugReporter bugReporter) Set the BugReporter.void
setBugReporterDecorators
(Set<String> explicitlyEnabled, Set<String> explicitlyDisabled) void
setClassScreener
(IClassScreener classScreener) Set the ClassScreener.void
setDetectorFactoryCollection
(DetectorFactoryCollection detectorFactoryCollection) Set the DetectorFactoryCollection from which plugins/detectors may be accessed.void
setMergeSimilarWarnings
(boolean mergeSimilarWarnings) void
setNoClassOk
(boolean noClassOk) Set whether or not to generate an empty output file if there were no class files specified.void
setProgressCallback
(FindBugsProgress progressCallback) Set the progress callback that will be used to keep track of the progress of the analysis.void
setProject
(Project project) Set the Project.void
setProjectName
(String projectName) void
setRankThreshold
(int rankThreshold) void
setRelaxedReportingMode
(boolean relaxedReportingMode) Set relaxed reporting mode.void
setReleaseName
(String releaseName) void
setScanNestedArchives
(boolean scanNestedArchives) Set whether or not nested archives should be scanned.void
setSourceInfoFile
(String sourceInfoFile) Set the filename of the source info file containing line numbers for fields and classes.void
setUserPreferences
(UserPreferences userPreferences) Set the UserPreferences representing which Detectors should be used.boolean
Return whether or not we should make use of training data.
-
Method Details
-
getBugReporter
BugReporter getBugReporter()Get the BugReporter.- Returns:
- the BugReporter
-
setBugReporter
Set the BugReporter.- Parameters:
bugReporter
- The BugReporter to set
-
setProject
Set the Project.- Parameters:
project
- The Project to set
-
getProject
Project getProject()Get the Project.- Returns:
- the Project
-
setProgressCallback
Set the progress callback that will be used to keep track of the progress of the analysis.- Parameters:
progressCallback
- the progress callback
-
addFilter
Set filter of bug instances to include or exclude.- Parameters:
filterFileName
- the name of the filter fileinclude
- true if the filter specifies bug instances to include, false if it specifies bug instances to exclude- Throws:
IOException
FilterException
-
excludeBaselineBugs
Provide baseline of bugs not to report- Parameters:
baselineBugs
- the name of the xml bug baseline file- Throws:
org.dom4j.DocumentException
IOException
-
setUserPreferences
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
Add an IClassObserver.- Parameters:
classObserver
- the IClassObserver
-
setClassScreener
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
Set whether or not training output should be emitted.- Parameters:
trainingOutputDir
- directory to save training output in
-
enableTrainingInput
Set whether or not training input should be used to make the analysis more precise.- Parameters:
trainingInputDir
- directory to load training input from
-
setAnalysisFeatureSettings
Set analysis feature settings.- Parameters:
settingList
- list of analysis feature settings
-
getReleaseName
String getReleaseName()- Returns:
- Returns the releaseName.
-
setReleaseName
- Parameters:
releaseName
- The releaseName to set.
-
getProjectName
String getProjectName()- Returns:
- Returns the projectName.
-
setProjectName
- Parameters:
projectName
- The project name to set.
-
setSourceInfoFile
Set the filename of the source info file containing line numbers for fields and classes.- Parameters:
sourceInfoFile
- the source info filename
-
execute
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 filesInterruptedException
- 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
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
-