Package edu.umd.cs.findbugs
Class FindBugs
java.lang.Object
edu.umd.cs.findbugs.FindBugs
Static methods and fields useful for working with instances of
IFindBugsEngine.
This class was previously the main driver for FindBugs analyses, but has been
replaced by
FindBugs2
.- Author:
- Bill Pugh, David Hovemeyer
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
Debug tracing.static final AnalysisFeatureSetting[]
Analysis settings for -effort:default.Known URL protocols.static final AnalysisFeatureSetting[]
Analysis settings for -effort:less.static final Logger
static final AnalysisFeatureSetting[]
Analysis settings for -effort:max.static final AnalysisFeatureSetting[]
Analysis settings for -effort:min.static final long
Date of release of Java 1.0static final AnalysisFeatureSetting[]
Analysis settings for -effort:more. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BugReporter
configureBaselineFilter
(BugReporter bugReporter, String baselineFileName) Configure a baseline bug instance filter.static void
configureBugCollection
(IFindBugsEngine findBugs) Configure the BugCollection (if the BugReporter being used is constructing one).static BugReporter
configureFilter
(BugReporter bugReporter, String filterFileName, boolean include) Configure the (bug instance) Filter for the given DelegatingBugReporter.static void
configureTrainingDatabases
(IFindBugsEngine findBugs) Configure training databases.static String
getHome()
Get the FindBugs home directory.handleBugCategories
(String categories) Process -bugCategories option.static boolean
isDetectorEnabled
(IFindBugsEngine findBugs, DetectorFactory factory, int rankThreshold) Determines whether or not given DetectorFactory should be enabled.static boolean
static boolean
static void
processCommandLine
(TextUICommandLine commandLine, String[] argv, IFindBugsEngine findBugs) Process the command line.static void
runMain
(IFindBugsEngine findBugs, TextUICommandLine commandLine) Given a fully-configured IFindBugsEngine and the TextUICommandLine used to configure it, execute the analysis.static void
Set the FindBugs home directory.static void
Disable analysis within FindBugs.static void
Disable loading of FindBugsMain classes.static void
Print command line options synopses to stdout.static void
showCommandLineOptions
(TextUICommandLine commandLine) Print command line options synopses to stdout.static void
showHelp
(TextUICommandLine commandLine) Show -help message.static void
Show the overall FindBugs command synopsis.static boolean
validTimestamp
(long timestamp)
-
Field Details
-
MIN_EFFORT
Analysis settings for -effort:min. -
LESS_EFFORT
Analysis settings for -effort:less. -
DEFAULT_EFFORT
Analysis settings for -effort:default. -
MORE_EFFORT
Analysis settings for -effort:more. -
MAX_EFFORT
Analysis settings for -effort:max. -
DEBUG
public static final boolean DEBUGDebug tracing. -
LOG
-
knownURLProtocolSet
Known URL protocols. Filename URLs that do not have an explicit protocol are assumed to be files. -
MINIMUM_TIMESTAMP
public static final long MINIMUM_TIMESTAMPDate of release of Java 1.0
-
-
Constructor Details
-
FindBugs
public FindBugs()
-
-
Method Details
-
setNoAnalysis
public static void setNoAnalysis()Disable analysis within FindBugs. Turns off loading of bug detectors. -
isNoAnalysis
public static boolean isNoAnalysis()- Returns:
- Returns the noAnalysis.
-
setNoMains
public static void setNoMains()Disable loading of FindBugsMain classes. -
isNoMains
public static boolean isNoMains()- Returns:
- Returns the noMains.
-
setHome
Set the FindBugs home directory. -
getHome
Get the FindBugs home directory. -
configureTrainingDatabases
Configure training databases.- Parameters:
findBugs
- the IFindBugsEngine to configure- Throws:
IOException
-
isDetectorEnabled
public static boolean isDetectorEnabled(IFindBugsEngine findBugs, DetectorFactory factory, int rankThreshold) Determines whether or not given DetectorFactory should be enabled.- Parameters:
findBugs
- the IFindBugsEnginefactory
- the DetectorFactoryrankThreshold
- TODO- Returns:
- true if the DetectorFactory should be enabled, false otherwise
-
handleBugCategories
Process -bugCategories option.- Parameters:
categories
- comma-separated list of bug categories- Returns:
- Set of categories to be used
-
processCommandLine
public static void processCommandLine(TextUICommandLine commandLine, String[] argv, IFindBugsEngine findBugs) throws IOException, FilterException Process the command line.- Parameters:
commandLine
- the TextUICommandLine object which will parse the command lineargv
- the command line argumentsfindBugs
- the IFindBugsEngine to configure- Throws:
IOException
FilterException
-
showHelp
Show -help message.- Parameters:
commandLine
-
-
runMain
public static void runMain(IFindBugsEngine findBugs, TextUICommandLine commandLine) throws IOException Given a fully-configured IFindBugsEngine and the TextUICommandLine used to configure it, execute the analysis.- Parameters:
findBugs
- a fully-configured IFindBugsEnginecommandLine
- the TextUICommandLine used to configure the IFindBugsEngine- Throws:
IOException
-
showCommandLineOptions
public static void showCommandLineOptions()Print command line options synopses to stdout. -
showCommandLineOptions
Print command line options synopses to stdout.- Parameters:
commandLine
- the TextUICommandLine whose options should be printed
-
showSynopsis
public static void showSynopsis()Show the overall FindBugs command synopsis. -
configureFilter
public static BugReporter configureFilter(BugReporter bugReporter, String filterFileName, boolean include) throws IOException, FilterException Configure the (bug instance) Filter for the given DelegatingBugReporter.- Parameters:
bugReporter
- a DelegatingBugReporterfilterFileName
- filter file nameinclude
- true if the filter is an include filter, false if it's an exclude filter- Throws:
IOException
FilterException
-
configureBaselineFilter
public static BugReporter configureBaselineFilter(BugReporter bugReporter, String baselineFileName) throws IOException, org.dom4j.DocumentException Configure a baseline bug instance filter.- Parameters:
bugReporter
- a DelegatingBugReporterbaselineFileName
- filename of baseline Filter- Throws:
IOException
org.dom4j.DocumentException
-
configureBugCollection
Configure the BugCollection (if the BugReporter being used is constructing one).- Parameters:
findBugs
- the IFindBugsEngine
-
validTimestamp
public static boolean validTimestamp(long timestamp)
-