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 interfaceHandling 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 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 intprivate Stringprivate booleanprivate intprivate Stringprivate booleanprivate Stringprivate List<TextUIBugReporter> private static final intprivate booleanprivate booleanprivate booleanprivate static final intprivate Stringprivate Stringprivate Stringprivate booleanprivate booleanprivate static final intprivate static final intprivate booleanFields inherited from class edu.umd.cs.findbugs.FindBugsCommandLine
project, projectLoadedFromFile, settingList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAuxClassPathEntries(String argument) Parse the argument as auxclasspath entries and add thembooleanprivate 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.voidHandle -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) ParseoptionExtraPartand create a path-associated if it contains the output file path such as":withMessages=path/to/file.extension"and"=/absolute/path/to/file.extension".booleanbooleanbooleanbooleanquiet()booleanMethods inherited from class edu.umd.cs.findbugs.FindBugsCommandLine
getSettingList, isProjectLoadedFromFile, loadProjectMethods 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:
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() -
initializeReporter
<T extends TextUIBugReporter> TextUIBugReporter initializeReporter(String optionExtraPart, Supplier<T> ctor, BiConsumer<T, String> handleOptions) ParseoptionExtraPartand 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 betweenandinvalid 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 createdBugReporterinstance.- 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: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.
-