Class Main.CliOptions

  • Enclosing class:
    Main

    private static class Main.CliOptions
    extends java.lang.Object
    Command line options.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String ATTRIB_TAB_WIDTH_NAME
      Name for the moduleConfig attribute 'tabWidth'.
      private static int CHECKER_THREADS_NUMBER
      The checker threads number.
      private java.lang.String configurationFile
      Config file location.
      private boolean debug
      Option that controls whether to print debug info.
      private static Main.OutputFormat DEFAULT_OUTPUT_FORMAT
      Default output format.
      private static int DEFAULT_THREAD_COUNT
      The default number of threads to use for checker and the tree walker.
      private java.util.List<java.io.File> exclude
      Option that allows users to specify a list of paths to exclude.
      private java.util.List<java.util.regex.Pattern> excludeRegex
      Option that allows users to specify a regex of paths to exclude.
      private boolean executeIgnoredModules
      Switch whether to execute ignored modules or not.
      private java.util.List<java.io.File> files
      List of file to validate.
      private Main.OutputFormat format
      Output format.
      private boolean generateXpathSuppressionsFile
      Switch whether to generate suppressions file or not.
      private static int HELP_WIDTH
      Width of CLI help option.
      private static java.lang.String OUTPUT_FORMAT_OPTION
      Option name for output format.
      private java.nio.file.Path outputPath
      Output file location.
      private boolean printAst
      Option that controls whether to print the AST of the file.
      private boolean printAstWithComments
      Option that controls whether to print the AST of the file including comments.
      private boolean printJavadocTree
      Option that controls whether to print the parse tree of the javadoc comment.
      private boolean printTreeWithJavadoc
      Option that controls whether to print the full AST of the file.
      private java.io.File propertiesFile
      Properties file location.
      private java.lang.String suppressionLineColumnNumber
      LineNo and columnNo for the suppression.
      private int tabWidth
      Tab character length.
      private static int TREE_WALKER_THREADS_NUMBER
      The tree walker threads number.
      private java.lang.String xpath
      Show AST branches that match xpath.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CliOptions()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.List<java.util.regex.Pattern> getExclusions()
      Gets the list of exclusions provided through the command line arguments.
      private java.util.List<java.lang.String> validateCli​(picocli.CommandLine.ParseResult parseResult, java.util.List<java.io.File> filesToProcess)
      Validates the user-specified command line options.
      private java.util.List<java.lang.String> validateOptionalCliParametersIfConfigDefined()
      Validates optional command line parameters that might be used with config file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HELP_WIDTH

        private static final int HELP_WIDTH
        Width of CLI help option.
        See Also:
        Constant Field Values
      • DEFAULT_THREAD_COUNT

        private static final int DEFAULT_THREAD_COUNT
        The default number of threads to use for checker and the tree walker.
        See Also:
        Constant Field Values
      • ATTRIB_TAB_WIDTH_NAME

        private static final java.lang.String ATTRIB_TAB_WIDTH_NAME
        Name for the moduleConfig attribute 'tabWidth'.
        See Also:
        Constant Field Values
      • DEFAULT_OUTPUT_FORMAT

        private static final Main.OutputFormat DEFAULT_OUTPUT_FORMAT
        Default output format.
      • OUTPUT_FORMAT_OPTION

        private static final java.lang.String OUTPUT_FORMAT_OPTION
        Option name for output format.
        See Also:
        Constant Field Values
      • CHECKER_THREADS_NUMBER

        private static final int CHECKER_THREADS_NUMBER
        The checker threads number. Suppression: CanBeFinal - we use picocli and it use reflection to manage such fields This option has been skipped for CLI options intentionally.
        See Also:
        Constant Field Values
      • TREE_WALKER_THREADS_NUMBER

        private static final int TREE_WALKER_THREADS_NUMBER
        The tree walker threads number. Suppression: CanBeFinal - we use picocli and it use reflection to manage such fields This option has been skipped for CLI options intentionally.
        See Also:
        Constant Field Values
      • files

        private java.util.List<java.io.File> files
        List of file to validate.
      • configurationFile

        private java.lang.String configurationFile
        Config file location.
      • outputPath

        private java.nio.file.Path outputPath
        Output file location.
      • propertiesFile

        private java.io.File propertiesFile
        Properties file location.
      • suppressionLineColumnNumber

        private java.lang.String suppressionLineColumnNumber
        LineNo and columnNo for the suppression.
      • tabWidth

        private int tabWidth
        Tab character length. Suppression: CanBeFinal - we use picocli and it use reflection to manage such fields
      • generateXpathSuppressionsFile

        private boolean generateXpathSuppressionsFile
        Switch whether to generate suppressions file or not.
      • format

        private Main.OutputFormat format
        Output format. Suppression: CanBeFinal - we use picocli and it use reflection to manage such fields
      • printAst

        private boolean printAst
        Option that controls whether to print the AST of the file.
      • printAstWithComments

        private boolean printAstWithComments
        Option that controls whether to print the AST of the file including comments.
      • printJavadocTree

        private boolean printJavadocTree
        Option that controls whether to print the parse tree of the javadoc comment.
      • printTreeWithJavadoc

        private boolean printTreeWithJavadoc
        Option that controls whether to print the full AST of the file.
      • debug

        private boolean debug
        Option that controls whether to print debug info.
      • exclude

        private java.util.List<java.io.File> exclude
        Option that allows users to specify a list of paths to exclude. Suppression: CanBeFinal - we use picocli and it use reflection to manage such fields
      • excludeRegex

        private java.util.List<java.util.regex.Pattern> excludeRegex
        Option that allows users to specify a regex of paths to exclude. Suppression: CanBeFinal - we use picocli and it use reflection to manage such fields
      • executeIgnoredModules

        private boolean executeIgnoredModules
        Switch whether to execute ignored modules or not.
      • xpath

        private java.lang.String xpath
        Show AST branches that match xpath.
    • Constructor Detail

      • CliOptions

        private CliOptions()
    • Method Detail

      • getExclusions

        private java.util.List<java.util.regex.Pattern> getExclusions()
        Gets the list of exclusions provided through the command line arguments.
        Returns:
        List of exclusion patterns.
      • validateCli

        private java.util.List<java.lang.String> validateCli​(picocli.CommandLine.ParseResult parseResult,
                                                             java.util.List<java.io.File> filesToProcess)
        Validates the user-specified command line options.
        Parameters:
        parseResult - used to verify if the format option was specified on the command line
        filesToProcess - the list of files whose style to check
        Returns:
        list of violations
      • validateOptionalCliParametersIfConfigDefined

        private java.util.List<java.lang.String> validateOptionalCliParametersIfConfigDefined()
        Validates optional command line parameters that might be used with config file.
        Returns:
        list of violations