Package edu.umd.cs.findbugs
Class TextUICommandLine
java.lang.Object
edu.umd.cs.findbugs.config.CommandLine
edu.umd.cs.findbugs.FindBugsCommandLine
edu.umd.cs.findbugs.TextUICommandLine
Helper class to parse the command line and configure the IFindBugsEngine
object. As a side-effect it also configures a DetectorFactoryCollection (to
enable and disable detectors as requested).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interface
Handling callback for choose() method, used to implement the -chooseVisitors and -choosePlugins options.Nested classes/interfaces inherited from class edu.umd.cs.findbugs.config.CommandLine
CommandLine.HelpRequestedException
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private int
private final ClassScreener
private static final boolean
private static final int
private static final int
private final org.slf4j.Logger
private boolean
private boolean
protected File
private PrintStream
private boolean
private static final int
private boolean
private int
private String
private boolean
private int
private String
private boolean
private String
private List
<TextUIBugReporter> private static final int
private boolean
private boolean
private boolean
private static final int
private String
private String
private String
private boolean
private boolean
private static final int
private static final int
private boolean
Fields inherited from class edu.umd.cs.findbugs.FindBugsCommandLine
project, projectLoadedFromFile, settingList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addAuxClassPathEntries
(String argument) Parse the argument as auxclasspath entries and add themboolean
private void
choose
(String argument, String desc, TextUICommandLine.Chooser chooser) Common handling code for -chooseVisitors and -choosePlugins options.void
configureEngine
(IFindBugsEngine findBugs) private UserPreferences
boolean
getXargs()
private void
handleAnalyzeFromFile
(String filePath) Handle -analyzeFromFile command line option by reading jar file names from a file and adding them to the project.private void
handleAuxClassPathFromFile
(String filePath) Handle -readAuxFromFile command line option by reading classpath entries from a file and adding them to the project.protected void
handleOption
(String option, String optionExtraPart) Callback method for handling an option.protected void
handleOptionWithArgument
(String option, String argument) Callback method for handling an option with an argument.void
Handle -xargs command line option by reading jar file names from standard input and adding them to the project.(package private) <T extends TextUIBugReporter>
TextUIBugReporterinitializeReporter
(String optionExtraPart, Supplier<T> ctor, BiConsumer<T, String> handleOptions) ParseoptionExtraPart
and create a path-associated if it contains the output file path such as":withMessages=path/to/file.extension"
and"=/absolute/path/to/file.extension"
.boolean
boolean
boolean
boolean
quiet()
boolean
Methods inherited from class edu.umd.cs.findbugs.FindBugsCommandLine
getSettingList, isProjectLoadedFromFile, loadProject
Methods inherited from class edu.umd.cs.findbugs.config.CommandLine
addOption, addSwitch, addSwitchWithOptionalExtraPart, expandOptionFiles, getAnalysisOptionProperties, makeOptionUnlisted, parse, parse, printUsage, startOptionGroup
-
Field Details
-
logger
private final org.slf4j.Logger logger -
DEBUG
private static final boolean DEBUG -
PRINTING_REPORTER
private static final int PRINTING_REPORTER- See Also:
-
SORTING_REPORTER
private static final int SORTING_REPORTER- See Also:
-
XML_REPORTER
private static final int XML_REPORTER- See Also:
-
EMACS_REPORTER
private static final int EMACS_REPORTER- See Also:
-
HTML_REPORTER
private static final int HTML_REPORTER- See Also:
-
XDOCS_REPORTER
private static final int XDOCS_REPORTER- See Also:
-
SARIF_REPORTER
private static final int SARIF_REPORTER- See Also:
-
bugReporterType
private int bugReporterType -
relaxedReportingMode
private boolean relaxedReportingMode -
useLongBugCodes
private boolean useLongBugCodes -
showProgress
private boolean showProgress -
xmlWithAbridgedMessages
private boolean xmlWithAbridgedMessages -
quiet
private boolean quiet -
classScreener
-
enabledBugReporterDecorators
-
disabledBugReporterDecorators
-
usedReporterPaths
-
setExitCode
private boolean setExitCode -
noClassOk
private boolean noClassOk -
priorityThreshold
private int priorityThreshold -
rankThreshold
private int rankThreshold -
outputStream
-
bugCategorySet
-
trainingOutputDir
-
trainingInputDir
-
releaseName
-
projectName
-
sourceInfoFile
-
redoAnalysisFile
-
mergeSimilarWarnings
private boolean mergeSimilarWarnings -
xargs
private boolean xargs -
scanNestedArchives
private boolean scanNestedArchives -
applySuppression
private boolean applySuppression -
printConfiguration
private boolean printConfiguration -
printVersion
private boolean printVersion -
parsedOptions
-
reporters
-
outputFile
-
-
Constructor Details
-
TextUICommandLine
public TextUICommandLine()Constructor.
-
-
Method Details
-
getProject
- Overrides:
getProject
in classFindBugsCommandLine
-
getXargs
public boolean getXargs() -
setExitCode
public boolean setExitCode() -
noClassOk
public boolean noClassOk() -
quiet
public boolean quiet() -
applySuppression
public boolean applySuppression() -
justPrintConfiguration
public boolean justPrintConfiguration() -
justPrintVersion
public boolean justPrintVersion() -
initializeReporter
<T extends TextUIBugReporter> TextUIBugReporter initializeReporter(String optionExtraPart, Supplier<T> ctor, BiConsumer<T, String> handleOptions) ParseoptionExtraPart
and create a path-associated if it contains the output file path such as":withMessages=path/to/file.extension"
and"=/absolute/path/to/file.extension"
. Finally configure the created BugReporter with theoptionExtraPart
's configuration information.- Type Parameters:
T
- The implementation type of the to propagate type information betweeninvalid reference
ctor
invalid reference
handleOptions
- Parameters:
optionExtraPart
- extra part of the specified commandline optionctor
- A supplier for an unconfigured .handleOptions
- A function that can configure the createdBugReporter
instance.- Returns:
- The fully configured reporter, or
null
, if the reporter would output to a file that is already used as a reporter output file.
-
handleOption
Description copied from class:CommandLine
Callback method for handling an option.- Overrides:
handleOption
in classFindBugsCommandLine
- Parameters:
option
- the optionoptionExtraPart
- the "extra" part of the option (everything after the colon: e.g., "withMessages" in "-xml:withMessages"); the empty string if there was no extra part
-
handleOptionWithArgument
Description copied from class:CommandLine
Callback method for handling an option with an argument.- Overrides:
handleOptionWithArgument
in classFindBugsCommandLine
- Parameters:
option
- the optionargument
- the argument- Throws:
IOException
-
addAuxClassPathEntries
Parse the argument as auxclasspath entries and add them- Parameters:
argument
-
-
choose
Common handling code for -chooseVisitors and -choosePlugins options.- Parameters:
argument
- the list of visitors or plugins to be chosendesc
- String describing what is being chosenchooser
- callback object to selectively choose list members
-
configureEngine
- Throws:
IOException
FilterException
-
handleXArgs
Handle -xargs command line option by reading jar file names from standard input and adding them to the project.- Throws:
IOException
-
handleAuxClassPathFromFile
Handle -readAuxFromFile command line option by reading classpath entries from a file and adding them to the project.- Throws:
IOException
-
handleAnalyzeFromFile
Handle -analyzeFromFile command line option by reading jar file names from a file and adding them to the project.- Throws:
IOException
-
getUserPreferences
- Returns:
- Returns the userPreferences.
-