def main(): # pylint: disable=import-outside-toplevel from argparse import ArgumentParser # pylint: enable=import-outside-toplevel ap = ArgumentParser() ap.add_argument("name", metavar="FILE|DIR") options = ap.parse_args() mh = Message_Handler("debug") mh.sort_messages = False mh.colour = False if os.path.isfile(options.name): sanity_test(mh, options.name, options) elif os.path.isdir(options.name): for path, _, files in os.walk(options.name): for f in files: if f.endswith(".slx"): sanity_test(mh, os.path.join(path, f), options) else: ap.error("%s is neither a file or directory" % options.name) print() print("=== Summary of misc. children ===") for block_type in sorted(anatomy): print("Children in %s" % block_type) for tag in sorted(anatomy[block_type]): print(" * %s" % tag) mh.summary_and_exit()
def sanity_test(): # pylint: disable=import-outside-toplevel from argparse import ArgumentParser import traceback # pylint: enable=import-outside-toplevel ap = ArgumentParser() ap.add_argument("item", metavar="FILE|DIR") ap.add_argument("--no-tb", action="store_true", default=False, help="Do not show debug-style backtrace") options = ap.parse_args() mh = Message_Handler("debug") mh.sort_messages = False mh.colour = False try: register_item(mh, options.item, options) except Error: if not options.no_tb: traceback.print_exc() except ICE as ice: if not options.no_tb: traceback.print_exc() print("ICE:", ice.reason) for dirname in sorted(tree): print("Showing config for %s" % dirname) node = tree[dirname] print(" Root: %s" % node.project_root) print(" File: %s" % ", ".join(node.config_files)) cfg = node.config if cfg is None: print(" No config attached") continue print(" Enabled = %s" % cfg.enabled) print(" Octave = %s" % cfg.octave) print(" Rules = %u" % len(cfg.style_rules)) print(" SConf = %s" % cfg.style_config) print(" Metrics = %u" % len(cfg.enabled_metrics)) print(" Limits = %s" % cfg.metric_limits)
def cfg_parser_main(): # pylint: disable=import-outside-toplevel from argparse import ArgumentParser # pylint: enable=import-outside-toplevel ap = ArgumentParser() ap.add_argument("file") ap.add_argument("--no-tb", action="store_true", default=False, help="Do not show debug-style backtrace") options = ap.parse_args() mh = Message_Handler("debug") mh.sort_messages = False mh.colour = False sanity_test(mh, options.file, not options.no_tb) mh.summary_and_exit()