Exemplo n.º 1
0
def main(argv=None):
    argv = argv if argv is not None else sys.argv[1:]

    parser = argparse.ArgumentParser(
        description='Generates metrics from a git repo',
    )
    # optional
    options.add_skip_default_metrics(parser)
    options.add_tempdir_location(parser)
    # positional
    options.add_repo(parser)
    options.add_database(parser)
    options.add_metric_package_names(parser)
    args = parser.parse_args(argv)

    if not os.path.exists(args.database):
        print('Not found: {0}'.format(args.database))
        print('Use git-code-debt-create-tables to create a database.')
        return 1

    load_data(
        args.database,
        args.repo,
        args.metric_package_names,
        args.skip_default_metrics,
        args.tempdir_location,
    )
Exemplo n.º 2
0
def get_options_from_argparse(argv):
    parser = argparse.ArgumentParser(
        description='Generates metrics from a git repo', )
    # optional
    options.add_skip_default_metrics(parser)
    # positional
    options.add_repo(parser)
    options.add_database(parser)
    options.add_metric_package_names(parser)
    # These are added here so the help message includes them but are unused
    _add_config_file_options(parser)
    args = parser.parse_args(argv)
    return args
Exemplo n.º 3
0
def get_options_from_argparse(argv):
    parser = argparse.ArgumentParser(
        description='Generates metrics from a git repo',
    )
    # optional
    options.add_skip_default_metrics(parser)
    # positional
    options.add_repo(parser)
    options.add_database(parser)
    options.add_metric_package_names(parser)
    # These are added here so the help message includes them but are unused
    _add_config_file_options(parser)
    args = parser.parse_args(argv)
    return args
Exemplo n.º 4
0
def main(argv=None):
    argv = argv if argv is not None else sys.argv[1:]

    parser = argparse.ArgumentParser(description="Set up schema")
    # optional
    options.add_skip_default_metrics(parser)
    # positional
    options.add_database(parser)
    options.add_metric_package_names(parser)
    args = parser.parse_args(argv)

    with sqlite3.connect(args.database) as db:
        create_schema(db)
        populate_metric_ids(db, args.metric_package_names, args.skip_default_metrics)
Exemplo n.º 5
0
def main(argv=None):
    parser = argparse.ArgumentParser(description='Set up schema')
    # optional
    options.add_skip_default_metrics(parser)
    # positional
    options.add_database(parser)
    options.add_metric_package_names(parser)
    args = parser.parse_args(argv)

    with sqlite3.connect(args.database) as db:
        create_schema(db)
        populate_metric_ids(
            db,
            args.metric_package_names,
            args.skip_default_metrics,
        )