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
-
public class TextUICommandLine extends FindBugsCommandLine
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 Classes Modifier and Type Class Description private static interfaceTextUICommandLine.ChooserHandling 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
Fields Modifier and Type Field Description private booleanapplySuppressionprivate java.util.Set<java.lang.String>bugCategorySetprivate intbugReporterTypeprivate ClassScreenerclassScreenerprivate static booleanDEBUGprivate java.util.Set<java.lang.String>disabledBugReporterDecoratorsprivate static intEMACS_REPORTERprivate java.util.Set<java.lang.String>enabledBugReporterDecoratorsprivate static intHTML_REPORTERprivate org.slf4j.Loggerloggerprivate booleanmergeSimilarWarningsprivate booleannoClassOkprotected java.io.FileoutputFileprivate java.io.PrintStreamoutputStream(package private) java.util.Map<java.lang.String,java.lang.String>parsedOptionsprivate booleanprintConfigurationprivate static intPRINTING_REPORTERprivate booleanprintVersionprivate intpriorityThresholdprivate java.lang.StringprojectNameprivate booleanquietprivate intrankThresholdprivate java.lang.StringredoAnalysisFileprivate booleanrelaxedReportingModeprivate java.lang.StringreleaseNameprivate java.util.List<TextUIBugReporter>reportersprivate static intSARIF_REPORTERprivate booleanscanNestedArchivesprivate booleansetExitCodeprivate booleanshowProgressprivate static intSORTING_REPORTERprivate java.lang.StringsourceInfoFileprivate java.lang.StringtrainingInputDirprivate java.lang.StringtrainingOutputDirprivate booleanuseLongBugCodesprivate static java.lang.StringUSER_PREFSprivate booleanxargsprivate static intXDOCS_REPORTERprivate static intXML_REPORTERprivate booleanxmlWithAbridgedMessages-
Fields inherited from class edu.umd.cs.findbugs.FindBugsCommandLine
project, projectLoadedFromFile, settingList
-
-
Constructor Summary
Constructors Constructor Description TextUICommandLine()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddAuxClassPathEntries(java.lang.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.booleanapplySuppression()private voidchoose(java.lang.String argument, java.lang.String desc, TextUICommandLine.Chooser chooser)Common handling code for -chooseVisitors and -choosePlugins options.voidconfigureEngine(IFindBugsEngine findBugs)ProjectgetProject()private UserPreferencesgetUserPreferences()booleangetXargs()private voidhandleAnalyzeFromFile(java.lang.String filePath)Handle -analyzeFromFile command line option by reading jar file names from a file and adding them to the project.private voidhandleAuxClassPathFromFile(java.lang.String filePath)Handle -readAuxFromFile command line option by reading classpath entries from a file and adding them to the project.protected voidhandleOption(java.lang.String option, java.lang.String optionExtraPart)Callback method for handling an option.protected voidhandleOptionWithArgument(java.lang.String option, java.lang.String argument)Callback method for handling an option with an argument.(package private) java.lang.StringhandleOutputFilePath(TextUIBugReporter reporter, java.lang.String optionExtraPart)ParseoptionExtraPartand configure if it contains the output file path such as":withMessages=path/to/file.extension"and"=/absolute/path/to/file.extension".voidhandleXArgs()Handle -xargs command line option by reading jar file names from standard input and adding them to the project.booleanjustPrintConfiguration()booleanjustPrintVersion()booleannoClassOk()booleanquiet()booleansetExitCode()-
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 Detail
-
USER_PREFS
private static final java.lang.String USER_PREFS
- See Also:
- Constant Field Values
-
logger
private final org.slf4j.Logger logger
-
DEBUG
private static final boolean DEBUG
-
PRINTING_REPORTER
private static final int PRINTING_REPORTER
- See Also:
- Constant Field Values
-
SORTING_REPORTER
private static final int SORTING_REPORTER
- See Also:
- Constant Field Values
-
XML_REPORTER
private static final int XML_REPORTER
- See Also:
- Constant Field Values
-
EMACS_REPORTER
private static final int EMACS_REPORTER
- See Also:
- Constant Field Values
-
HTML_REPORTER
private static final int HTML_REPORTER
- See Also:
- Constant Field Values
-
XDOCS_REPORTER
private static final int XDOCS_REPORTER
- See Also:
- Constant Field Values
-
SARIF_REPORTER
private static final int SARIF_REPORTER
- See Also:
- Constant Field Values
-
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
private final ClassScreener classScreener
-
enabledBugReporterDecorators
private final java.util.Set<java.lang.String> enabledBugReporterDecorators
-
disabledBugReporterDecorators
private final java.util.Set<java.lang.String> disabledBugReporterDecorators
-
setExitCode
private boolean setExitCode
-
noClassOk
private boolean noClassOk
-
priorityThreshold
private int priorityThreshold
-
rankThreshold
private int rankThreshold
-
outputStream
private java.io.PrintStream outputStream
-
bugCategorySet
private java.util.Set<java.lang.String> bugCategorySet
-
trainingOutputDir
private java.lang.String trainingOutputDir
-
trainingInputDir
private java.lang.String trainingInputDir
-
releaseName
private java.lang.String releaseName
-
projectName
private java.lang.String projectName
-
sourceInfoFile
private java.lang.String sourceInfoFile
-
redoAnalysisFile
private java.lang.String 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
java.util.Map<java.lang.String,java.lang.String> parsedOptions
-
reporters
private java.util.List<TextUIBugReporter> reporters
-
outputFile
@CheckForNull protected java.io.File outputFile
-
-
Method Detail
-
getProject
@Nonnull public Project 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
java.lang.String handleOutputFilePath(TextUIBugReporter reporter, java.lang.String optionExtraPart)
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
protected void handleOption(java.lang.String option, java.lang.String optionExtraPart)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
protected void handleOptionWithArgument(java.lang.String option, java.lang.String argument) throws java.io.IOExceptionDescription copied from class:CommandLineCallback method for handling an option with an argument.- Overrides:
handleOptionWithArgumentin classFindBugsCommandLine- Parameters:
option- the optionargument- the argument- Throws:
java.io.IOException
-
addAuxClassPathEntries
private void addAuxClassPathEntries(java.lang.String argument)
Parse the argument as auxclasspath entries and add them- Parameters:
argument-
-
choose
private void choose(java.lang.String argument, java.lang.String desc, TextUICommandLine.Chooser chooser)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
public void configureEngine(IFindBugsEngine findBugs) throws java.io.IOException, FilterException
- Throws:
java.io.IOExceptionFilterException
-
handleXArgs
public void handleXArgs() throws java.io.IOExceptionHandle -xargs command line option by reading jar file names from standard input and adding them to the project.- Throws:
java.io.IOException
-
handleAuxClassPathFromFile
private void handleAuxClassPathFromFile(java.lang.String filePath) throws java.io.IOExceptionHandle -readAuxFromFile command line option by reading classpath entries from a file and adding them to the project.- Throws:
java.io.IOException
-
handleAnalyzeFromFile
private void handleAnalyzeFromFile(java.lang.String filePath) throws java.io.IOExceptionHandle -analyzeFromFile command line option by reading jar file names from a file and adding them to the project.- Throws:
java.io.IOException
-
getUserPreferences
private UserPreferences getUserPreferences()
- Returns:
- Returns the userPreferences.
-
addDistinctBugReporter
private void addDistinctBugReporter(TextUIBugReporter reporter)
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.
-
-