parameters: (args)
return_statement: return result
docstring: Generates cover report and returns the number of bugs/crashes.
docstring_summary: Generates cover report and returns the number of bugs/crashes.
docstring_tokens: Generates cover report and returns the number of bugs / crashes .
function: def document(args):
      """ Generates cover report and returns the number of bugs/crashes. """
  
      html_reports_available = args.output_format in {'html', 'plist-html'}
  
      logging.debug('count crashes and bugs')
      crash_count = sum(1 for _ in read_crashes(args.output))
      bug_counter = create_counters()
      for bug in read_bugs(args.output, html_reports_available):
          bug_counter(bug)
      result = crash_count + bug_counter.total
  
      if html_reports_available and result:
          use_cdb = os.path.exists(args.cdb)
  
          logging.debug('generate index.html file')
          # common prefix for source files to have sorter path
          prefix = commonprefix_from(args.cdb) if use_cdb else os.getcwd()
          # assemble the cover from multiple fragments
          fragments = []
          try:
              if bug_counter.total:
                  fragments.append(bug_summary(args.output, bug_counter))
                  fragments.append(bug_report(args.output, prefix))
              if crash_count:
                  fragments.append(crash_report(args.output, prefix))
              assemble_cover(args, prefix, fragments)
              # copy additional files to the report
              copy_resource_files(args.output)
              if use_cdb:
                  shutil.copy(args.cdb, args.output)
          finally:
              for fragment in fragments:
                  os.remove(fragment)
      return result
function_tokens: def document ( args ) : html_reports_available = args . output_format in { 'html' , 'plist-html' } logging . debug ( 'count crashes and bugs' ) crash_count = sum ( 1 for _ in read_crashes ( args . output ) ) bug_counter = create_counters ( ) for bug in read_bugs ( args . output , html_reports_available ) : bug_counter ( bug ) result = crash_count + bug_counter . total if html_reports_available and result : use_cdb = os . path . exists ( args . cdb ) logging . debug ( 'generate index.html file' ) # common prefix for source files to have sorter path prefix = commonprefix_from ( args . cdb ) if use_cdb else os . getcwd ( ) # assemble the cover from multiple fragments fragments = [ ] try : if bug_counter . total : fragments . append ( bug_summary ( args . output , bug_counter ) ) fragments . append ( bug_report ( args . output , prefix ) ) if crash_count : fragments . append ( crash_report ( args . output , prefix ) ) assemble_cover ( args , prefix , fragments ) # copy additional files to the report copy_resource_files ( args . output ) if use_cdb : shutil . copy ( args . cdb , args . output ) finally : for fragment in fragments : os . remove ( fragment ) return result