Class 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).
    • Field Detail

      • logger

        private final org.slf4j.Logger logger
      • DEBUG

        private static final boolean DEBUG
      • bugReporterType

        private int bugReporterType
      • relaxedReportingMode

        private boolean relaxedReportingMode
      • useLongBugCodes

        private boolean useLongBugCodes
      • showProgress

        private boolean showProgress
      • xmlWithAbridgedMessages

        private boolean xmlWithAbridgedMessages
      • quiet

        private boolean quiet
      • 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
      • outputFile

        @CheckForNull
        protected java.io.File outputFile
    • Constructor Detail

      • TextUICommandLine

        public TextUICommandLine()
        Constructor.
    • Method Detail

      • 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)
        Parse optionExtraPart 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 a PrintStream based on the given file path
        optionExtraPart - 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: CommandLine
        Callback method for handling an option.
        Overrides:
        handleOption in class FindBugsCommandLine
        Parameters:
        option - the option
        optionExtraPart - 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.IOException
        Description copied from class: CommandLine
        Callback method for handling an option with an argument.
        Overrides:
        handleOptionWithArgument in class FindBugsCommandLine
        Parameters:
        option - the option
        argument - 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 chosen
        desc - String describing what is being chosen
        chooser - callback object to selectively choose list members
      • handleXArgs

        public void handleXArgs()
                         throws java.io.IOException
        Handle -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.IOException
        Handle -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.IOException
        Handle -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.