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 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

      private final ClassScreener classScreener
    • enabledBugReporterDecorators

      private final Set<String> enabledBugReporterDecorators
    • disabledBugReporterDecorators

      private final Set<String> disabledBugReporterDecorators
    • setExitCode

      private boolean setExitCode
    • noClassOk

      private boolean noClassOk
    • priorityThreshold

      private int priorityThreshold
    • rankThreshold

      private int rankThreshold
    • outputStream

      private PrintStream outputStream
    • bugCategorySet

      private Set<String> bugCategorySet
    • trainingOutputDir

      private String trainingOutputDir
    • trainingInputDir

      private String trainingInputDir
    • releaseName

      private String releaseName
    • projectName

      private String projectName
    • sourceInfoFile

      private String sourceInfoFile
    • redoAnalysisFile

      private 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

      Map<String,String> parsedOptions
    • reporters

      private List<TextUIBugReporter> reporters
    • outputFile

      @CheckForNull protected File outputFile
  • Constructor Details

    • TextUICommandLine

      public TextUICommandLine()
      Constructor.
  • Method Details

    • getProject

      @Nonnull public Project getProject()
      Overrides:
      getProject in class FindBugsCommandLine
    • 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

      String handleOutputFilePath(TextUIBugReporter reporter, 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(String option, 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(String option, String argument) throws 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:
      IOException
    • addAuxClassPathEntries

      private void addAuxClassPathEntries(String argument)
      Parse the argument as auxclasspath entries and add them
      Parameters:
      argument -
    • choose

      private void choose(String argument, 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
    • configureEngine

      public void configureEngine(IFindBugsEngine findBugs) throws IOException, FilterException
      Throws:
      IOException
      FilterException
    • handleXArgs

      public void handleXArgs() throws IOException
      Handle -xargs command line option by reading jar file names from standard input and adding them to the project.
      Throws:
      IOException
    • handleAuxClassPathFromFile

      private void handleAuxClassPathFromFile(String filePath) throws IOException
      Handle -readAuxFromFile command line option by reading classpath entries from a file and adding them to the project.
      Throws:
      IOException
    • handleAnalyzeFromFile

      private void handleAnalyzeFromFile(String filePath) throws IOException
      Handle -analyzeFromFile command line option by reading jar file names from a file and adding them to the project.
      Throws:
      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.