parameters: (from_build_command)
return_statement: return parser
docstring: Creates a parser for command-line arguments to 'analyze'.
docstring_summary: Creates a parser for command-line arguments to 'analyze'.
docstring_tokens: Creates a parser for command - line arguments to analyze .
function: def create_analyze_parser(from_build_command):
      """ Creates a parser for command-line arguments to 'analyze'. """
  
      parser = create_default_parser()
  
      if from_build_command:
          parser_add_prefer_wrapper(parser)
          parser_add_compilers(parser)
  
          parser.add_argument(
              '--intercept-first',
              action='store_true',
              help="""Run the build commands first, intercept compiler
              calls and then run the static analyzer afterwards.
              Generally speaking it has better coverage on build commands.
              With '--override-compiler' it use compiler wrapper, but does
              not run the analyzer till the build is finished.""")
      else:
          parser_add_cdb(parser)
  
      parser.add_argument(
          '--status-bugs',
          action='store_true',
          help="""The exit status of '%(prog)s' is the same as the executed
          build command. This option ignores the build exit status and sets to
          be non zero if it found potential bugs or zero otherwise.""")
      parser.add_argument(
          '--exclude',
          metavar='<directory>',
          dest='excludes',
          action='append',
          default=[],
          help="""Do not run static analyzer against files found in this
          directory. (You can specify this option multiple times.)
          Could be useful when project contains 3rd party libraries.""")
  
      output = parser.add_argument_group('output control options')
      output.add_argument(
          '--output',
          '-o',
          metavar='<path>',
          default=tempfile.gettempdir(),
          help="""Specifies the output directory for analyzer reports.
          Subdirectory will be created if default directory is targeted.""")
      output.add_argument(
          '--keep-empty',
          action='store_true',
          help="""Don't remove the build results directory even if no issues
          were reported.""")
      output.add_argument(
          '--html-title',
          metavar='<title>',
          help="""Specify the title used on generated HTML pages.
          If not specified, a default title will be used.""")
      format_group = output.add_mutually_exclusive_group()
      format_group.add_argument(
          '--plist',
          '-plist',
          dest='output_format',
          const='plist',
          default='html',
          action='store_const',
          help="""Cause the results as a set of .plist files.""")
      format_group.add_argument(
          '--plist-html',
          '-plist-html',
          dest='output_format',
          const='plist-html',
          default='html',
          action='store_const',
          help="""Cause the results as a set of .html and .plist files.""")
      # TODO: implement '-view '
  
      advanced = parser.add_argument_group('advanced options')
      advanced.add_argument(
          '--use-analyzer',
          metavar='<path>',
          dest='clang',
          default='clang',
          help="""'%(prog)s' uses the 'clang' executable relative to itself for
          static analysis. One can override this behavior with this option by
          using the 'clang' packaged with Xcode (on OS X) or from the PATH.""")
      advanced.add_argument(
          '--no-failure-reports',
          '-no-failure-reports',
          dest='output_failures',
          action='store_false',
          help="""Do not create a 'failures' subdirectory that includes analyzer
          crash reports and preprocessed source files.""")
      parser.add_argument(
          '--analyze-headers',
          action='store_true',
          help="""Also analyze functions in #included files. By default, such
          functions are skipped unless they are called by functions within the
          main source file.""")
      advanced.add_argument(
          '--stats',
          '-stats',
          action='store_true',
          help="""Generates visitation statistics for the project.""")
      advanced.add_argument(
          '--internal-stats',
          action='store_true',
          help="""Generate internal analyzer statistics.""")
      advanced.add_argument(
          '--maxloop',
          '-maxloop',
          metavar='<loop count>',
          type=int,
          help="""Specifiy the number of times a block can be visited before
          giving up. Increase for more comprehensive coverage at a cost of
          speed.""")
      advanced.add_argument(
          '--store',
          '-store',
          metavar='<model>',
          dest='store_model',
          choices=['region', 'basic'],
          help="""Specify the store model used by the analyzer. 'region'
          specifies a field- sensitive store model. 'basic' which is far less
          precise but can more quickly analyze code. 'basic' was the default
          store model for checker-0.221 and earlier.""")
      advanced.add_argument(
          '--constraints',
          '-constraints',
          metavar='<model>',
          dest='constraints_model',
          choices=['range', 'basic'],
          help="""Specify the constraint engine used by the analyzer. Specifying
          'basic' uses a simpler, less powerful constraint model used by
          checker-0.160 and earlier.""")
      advanced.add_argument(
          '--analyzer-config',
          '-analyzer-config',
          metavar='<options>',
          help="""Provide options to pass through to the analyzer's
          -analyzer-config flag. Several options are separated with comma:
          'key1=val1,key2=val2'
  
          Available options:
              stable-report-filename=true or false (default)
  
          Switch the page naming to:
          report-<filename>-<function/method name>-<id>.html
          instead of report-XXXXXX.html""")
      advanced.add_argument(
          '--force-analyze-debug-code',
          dest='force_debug',
          action='store_true',
          help="""Tells analyzer to enable assertions in code even if they were
          disabled during compilation, enabling more precise results.""")
  
      plugins = parser.add_argument_group('checker options')
      plugins.add_argument(
          '--load-plugin',
          '-load-plugin',
          metavar='<plugin library>',
          dest='plugins',
          action='append',
          help="""Loading external checkers using the clang plugin interface.""")
      plugins.add_argument(
          '--enable-checker',
          '-enable-checker',
          metavar='<checker name>',
          action=AppendCommaSeparated,
          help="""Enable specific checker.""")
      plugins.add_argument(
          '--disable-checker',
          '-disable-checker',
          metavar='<checker name>',
          action=AppendCommaSeparated,
          help="""Disable specific checker.""")
      plugins.add_argument(
          '--help-checkers',
          action='store_true',
          help="""A default group of checkers is run unless explicitly disabled.
          Exactly which checkers constitute the default group is a function of
          the operating system in use. These can be printed with this flag.""")
      plugins.add_argument(
          '--help-checkers-verbose',
          action='store_true',
          help="""Print all available checkers and mark the enabled ones.""")
  
      if from_build_command:
          parser.add_argument(
              dest='build', nargs=argparse.REMAINDER, help="""Command to run.""")
      return parser
function_tokens: def create_analyze_parser ( from_build_command ) : parser = create_default_parser ( ) if from_build_command : parser_add_prefer_wrapper ( parser ) parser_add_compilers ( parser ) parser . add_argument ( '--intercept-first' , action = 'store_true' , help = """Run the build commands first, intercept compiler
              calls and then run the static analyzer afterwards.
              Generally speaking it has better coverage on build commands.
              With '--override-compiler' it use compiler wrapper, but does
              not run the analyzer till the build is finished.""" ) else : parser_add_cdb ( parser ) parser . add_argument ( '--status-bugs' , action = 'store_true' , help = """The exit status of '%(prog)s' is the same as the executed
          build command. This option ignores the build exit status and sets to
          be non zero if it found potential bugs or zero otherwise.""" ) parser . add_argument ( '--exclude' , metavar = '<directory>' , dest = 'excludes' , action = 'append' , default = [ ] , help = """Do not run static analyzer against files found in this
          directory. (You can specify this option multiple times.)
          Could be useful when project contains 3rd party libraries.""" ) output = parser . add_argument_group ( 'output control options' ) output . add_argument ( '--output' , '-o' , metavar = '<path>' , default = tempfile . gettempdir ( ) , help = """Specifies the output directory for analyzer reports.
          Subdirectory will be created if default directory is targeted.""" ) output . add_argument ( '--keep-empty' , action = 'store_true' , help = """Don't remove the build results directory even if no issues
          were reported.""" ) output . add_argument ( '--html-title' , metavar = '<title>' , help = """Specify the title used on generated HTML pages.
          If not specified, a default title will be used.""" ) format_group = output . add_mutually_exclusive_group ( ) format_group . add_argument ( '--plist' , '-plist' , dest = 'output_format' , const = 'plist' , default = 'html' , action = 'store_const' , help = """Cause the results as a set of .plist files.""" ) format_group . add_argument ( '--plist-html' , '-plist-html' , dest = 'output_format' , const = 'plist-html' , default = 'html' , action = 'store_const' , help = """Cause the results as a set of .html and .plist files.""" ) # TODO: implement '-view ' advanced = parser . add_argument_group ( 'advanced options' ) advanced . add_argument ( '--use-analyzer' , metavar = '<path>' , dest = 'clang' , default = 'clang' , help = """'%(prog)s' uses the 'clang' executable relative to itself for
          static analysis. One can override this behavior with this option by
          using the 'clang' packaged with Xcode (on OS X) or from the PATH.""" ) advanced . add_argument ( '--no-failure-reports' , '-no-failure-reports' , dest = 'output_failures' , action = 'store_false' , help = """Do not create a 'failures' subdirectory that includes analyzer
          crash reports and preprocessed source files.""" ) parser . add_argument ( '--analyze-headers' , action = 'store_true' , help = """Also analyze functions in #included files. By default, such
          functions are skipped unless they are called by functions within the
          main source file.""" ) advanced . add_argument ( '--stats' , '-stats' , action = 'store_true' , help = """Generates visitation statistics for the project.""" ) advanced . add_argument ( '--internal-stats' , action = 'store_true' , help = """Generate internal analyzer statistics.""" ) advanced . add_argument ( '--maxloop' , '-maxloop' , metavar = '<loop count>' , type = int , help = """Specifiy the number of times a block can be visited before
          giving up. Increase for more comprehensive coverage at a cost of
          speed.""" ) advanced . add_argument ( '--store' , '-store' , metavar = '<model>' , dest = 'store_model' , choices = [ 'region' , 'basic' ] , help = """Specify the store model used by the analyzer. 'region'
          specifies a field- sensitive store model. 'basic' which is far less
          precise but can more quickly analyze code. 'basic' was the default
          store model for checker-0.221 and earlier.""" ) advanced . add_argument ( '--constraints' , '-constraints' , metavar = '<model>' , dest = 'constraints_model' , choices = [ 'range' , 'basic' ] , help = """Specify the constraint engine used by the analyzer. Specifying
          'basic' uses a simpler, less powerful constraint model used by
          checker-0.160 and earlier.""" ) advanced . add_argument ( '--analyzer-config' , '-analyzer-config' , metavar = '<options>' , help = """Provide options to pass through to the analyzer's
          -analyzer-config flag. Several options are separated with comma:
          'key1=val1,key2=val2'
  
          Available options:
              stable-report-filename=true or false (default)
  
          Switch the page naming to:
          report-<filename>-<function/method name>-<id>.html
          instead of report-XXXXXX.html""" ) advanced . add_argument ( '--force-analyze-debug-code' , dest = 'force_debug' , action = 'store_true' , help = """Tells analyzer to enable assertions in code even if they were
          disabled during compilation, enabling more precise results.""" ) plugins = parser . add_argument_group ( 'checker options' ) plugins . add_argument ( '--load-plugin' , '-load-plugin' , metavar = '<plugin library>' , dest = 'plugins' , action = 'append' , help = """Loading external checkers using the clang plugin interface.""" ) plugins . add_argument ( '--enable-checker' , '-enable-checker' , metavar = '<checker name>' , action = AppendCommaSeparated , help = """Enable specific checker.""" ) plugins . add_argument ( '--disable-checker' , '-disable-checker' , metavar = '<checker name>' , action = AppendCommaSeparated , help = """Disable specific checker.""" ) plugins . add_argument ( '--help-checkers' , action = 'store_true' , help = """A default group of checkers is run unless explicitly disabled.
          Exactly which checkers constitute the default group is a function of
          the operating system in use. These can be printed with this flag.""" ) plugins . add_argument ( '--help-checkers-verbose' , action = 'store_true' , help = """Print all available checkers and mark the enabled ones.""" ) if from_build_command : parser . add_argument ( dest = 'build' , nargs = argparse . REMAINDER , help = """Command to run.""" ) return parser