def main(): import sys import logging from optparse import OptionParser ### usage = "usage: %prog [options] [coverage files ... ]" option_parser = OptionParser(usage=usage) option_parser.add_option('-x', '--exclude-patterns', action="store", dest="exclude_patterns_file", help="file containing regexp patterns of files to exclude from report") option_parser.add_option('-f', '--files-list', action="store", dest="files_list", help="file containing filenames to report on") option_parser.add_option('-q', '--quiet', action='store_true', dest='quiet', help='Suppress all but error messages') option_parser.add_option('-D', '--debug', action='store_true', dest='debug', help='Show all debugging messages') (options, args) = option_parser.parse_args() if options.quiet: logging.setLevel(logging.WARNING) if options.debug: logger.setLevel(logging.DEBUG) exclude_patterns = [] if options.exclude_patterns_file: exclude_patterns = read_exclude_patterns(exclude_patterns_file) files_list = {} if options.files_list: files_list = annotate.read_files_list(options.files_list) if not args: args = ['.figleaf'] coverage = {} for filename in args: logger.debug("loading coverage info from '%s'\n" % (filename,)) d = figleaf.read_coverage(filename) coverage = figleaf.combine_coverage(coverage, d) if not coverage: logger.warning('EXITING -- no coverage info!\n') sys.exit(-1) create_report(coverage, exclude_patterns, files_list)
def main(): """ Command-line function to do HTML annotation (red/green). Setuptools entry-point for figleaf2cov; see setup.py. """ import sys import logging from optparse import OptionParser ### usage = "usage: %prog [options] [coverage files ... ]" option_parser = OptionParser(usage=usage) option_parser.add_option('-x', '--exclude-patterns', action="store", dest="exclude_patterns_file", help="file containing regexp patterns of files to exclude from report") option_parser.add_option('-f', '--files-list', action="store", dest="files_list", help="file containing filenames to report on") option_parser.add_option('-d', '--output-directory', action='store', dest="output_dir", default = "html", help="directory for HTML output") option_parser.add_option('-q', '--quiet', action='store_true', dest='quiet', help='Suppress all but error messages') option_parser.add_option('-D', '--debug', action='store_true', dest='debug', help='Show all debugging messages') option_parser.add_option('-z', '--no-zero', action='store_true', dest='no_zero', help='Omit files with zero lines covered.') (options, args) = option_parser.parse_args() logger.setLevel(logging.INFO) if options.quiet: logging.disable(logging.WARNING) if options.debug: logger.setLevel(logging.DEBUG) ### load/combine if not args: args = ['.figleaf'] coverage = {} for filename in args: logger.debug("loading coverage info from '%s'\n" % (filename,)) d = figleaf.read_coverage(filename) coverage = figleaf.combine_coverage(coverage, d) if not coverage: logger.warning('EXITING -- no coverage info!\n') sys.exit(-1) exclude = [] if options.exclude_patterns_file: exclude = annotate.read_exclude_patterns(options.exclude_patterns_file) files_list = {} if options.files_list: files_list = annotate.read_files_list(options.files_list) ### make directory prepare_reportdir(options.output_dir) report_as_html(coverage, options.output_dir, exclude, files_list, include_zero=not options.no_zero) print 'figleaf: HTML output written to %s' % (options.output_dir,)
def main(): import sys import logging from optparse import OptionParser ### usage = "usage: %prog [options] [coverage files ... ]" option_parser = OptionParser(usage=usage) option_parser.add_option('-x', '--exclude-patterns', action="store", dest="exclude_patterns_file", help="file containing regexp patterns of files to exclude from report") option_parser.add_option('-f', '--files-list', action="store", dest="files_list", help="file containing filenames to report on") option_parser.add_option('-d', '--output-directory', action='store', dest="output_dir", default = "html", help="directory for HTML output") option_parser.add_option('-q', '--quiet', action='store_true', dest='quiet', help='Suppress all but error messages') option_parser.add_option('-D', '--debug', action='store_true', dest='debug', help='Show all debugging messages') (options, args) = option_parser.parse_args() if options.quiet: logging.disable(logging.DEBUG) if options.debug: logger.setLevel(logging.DEBUG) ### load/combine if not args: args = ['.figleaf'] coverage = {} for filename in args: logger.debug("loading coverage info from '%s'\n" % (filename,)) try: d = figleaf.read_coverage(filename) coverage = figleaf.combine_coverage(coverage, d) except IOError: logger.error("cannot open filename '%s'\n" % (filename,)) if not coverage: logger.warning('EXITING -- no coverage info!\n') sys.exit(-1) exclude = [] if options.exclude_patterns_file: exclude = read_exclude_patterns(options.exclude_patterns_file) files_list = {} if options.files_list: files_list = read_files_list(options.files_list) ### make directory prepare_reportdir(options.output_dir) report_as_html(coverage, options.output_dir, exclude, files_list) print 'figleaf: HTML output written to %s' % (options.output_dir,)