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 themprivate void
addDistinctBugReporter
(TextUIBugReporter reporter) Adds a reporter to the aggregating list of reporters, skipping the operation if a duplicate reporter is already present.boolean
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.(package private) String
handleOutputFilePath
(TextUIBugReporter reporter, String optionExtraPart) ParseoptionExtraPart
and configure if it contains the output file path such as":withMessages=path/to/file.extension"
and"=/absolute/path/to/file.extension"
.void
Handle -xargs command line option by reading jar file names from standard input and adding them to the project.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
-
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() -
handleOutputFilePath
ParseoptionExtraPart
and configure if it contains the output file path such as":withMessages=path/to/file.extension"
and"=/absolute/path/to/file.extension"
.- Parameters:
reporter
- the reporter to set aPrintStream
based on the given file pathoptionExtraPart
- extra part of the specified commandline option- Returns:
- Remaining part of
optionExtraPart
-
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.
-
addDistinctBugReporter
Adds a reporter to the aggregating list of reporters, skipping the operation if a duplicate reporter is already present.- Parameters:
reporter
- The reporter to add to the list of known reporters.
-