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 interfaceHandling callback for choose() method, used to implement the -chooseVisitors and -choosePlugins options.Nested classes/interfaces inherited from class CommandLine
CommandLine.HelpRequestedException -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate intprivate final ClassScreenerprivate static final booleanprivate static final intprivate static final intprivate final org.slf4j.Loggerprivate booleanprivate booleanprotected Fileprivate PrintStreamprivate booleanprivate static final intprivate booleanprivate PriorityAdjusterprivate intprivate Stringprivate booleanprivate intprivate Stringprivate booleanprivate Stringprivate final List<TextUIBugReporter> private static final intprivate booleanprivate booleanprivate booleanprivate static final intprivate Stringprivate Stringprivate Stringprivate booleanprivate static final Stringprivate booleanprivate static final intprivate static final intprivate booleanFields inherited from class FindBugsCommandLine
project, projectLoadedFromFile, settingList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAuxClassPathEntries(String argument) Parse the argument as auxclasspath entries and add themprivate voidaddDistinctBugReporter(TextUIBugReporter reporter) Adds a reporter to the aggregating list of reporters, skipping the operation if a duplicate reporter is already present.booleanprivate voidchoose(String argument, String desc, TextUICommandLine.Chooser chooser) Common handling code for -chooseVisitors and -choosePlugins options.voidconfigureEngine(IFindBugsEngine findBugs) private UserPreferencesbooleangetXargs()private voidhandleAnalyzeFromFile(String filePath) Handle -analyzeFromFile command line option by reading jar file names from a file and adding them to the project.private voidhandleAuxClassPathFromFile(String filePath) Handle -readAuxFromFile command line option by reading classpath entries from a file and adding them to the project.protected voidhandleOption(String option, String optionExtraPart) Callback method for handling an option.protected voidhandleOptionWithArgument(String option, String argument) Callback method for handling an option with an argument.(package private) StringhandleOutputFilePath(TextUIBugReporter reporter, String optionExtraPart) ParseoptionExtraPartand configure if it contains the output file path such as":withMessages=path/to/file.extension"and"=/absolute/path/to/file.extension".voidHandle -xargs command line option by reading jar file names from standard input and adding them to the project.booleanbooleanbooleanbooleanquiet()booleanMethods inherited from class FindBugsCommandLine
getSettingList, isProjectLoadedFromFile, loadProjectMethods inherited from class CommandLine
addOption, addSwitch, addSwitchWithOptionalExtraPart, expandOptionFiles, getAnalysisOptionProperties, makeOptionUnlisted, parse, parse, printUsage, startOptionGroup
-
Field Details
-
USER_PREFS
- See Also:
-
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
-
priorityAdjuster
-
outputFile
-
-
Constructor Details
-
TextUICommandLine
public TextUICommandLine()Constructor.
-
-
Method Details
-
getProject
- Overrides:
getProjectin 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
ParseoptionExtraPartand 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 aPrintStreambased on the given file pathoptionExtraPart- extra part of the specified commandline option- Returns:
- Remaining part of
optionExtraPart
-
handleOption
Description copied from class:CommandLineCallback method for handling an option.- Overrides:
handleOptionin 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:CommandLineCallback method for handling an option with an argument.- Overrides:
handleOptionWithArgumentin 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:
IOExceptionFilterException
-
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.
-