To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 003c781d authored by scmalte's avatar scmalte
Browse files

cluster.py: added command-line options for thresholds

parent 89930c09
import re
import os
# import argparse
import argparse
import logging
import csv
import subprocess
......@@ -196,17 +196,35 @@ def create_clusters_matches_csv_file(cluster_entries, clusters_matches_csv_file)
for entry in cluster_entries:
csv_writer.writerow(entry.values_flattened())
def configure_cli_parser(parser):
parser.add_argument(
"-tp", "--threshold-percentage",
type=int,
help="Threshold for similarity in percentage; matches below will be excluded (default: {})".format(DEFAULT_THRESHOLD_PERCENTAGE))
parser.add_argument(
"-tl", "--threshold-lines",
type=int,
help="Threshold for similarity in lines of code; matches below will be excluded (default: {})".format(DEFAULT_THRESHOLD_LINES))
logutils.add_loglevel_argument(parser)
def main(
results_csv_file=DEFAULT_RESULTS_CSV_FILE,
total_graph_dot_file=DEFAULT_TOTAL_GRAPH_DOT_FILE,
cluster_files_dir=DEFAULT_CLUSTER_FILES_DIR,
cluster_file_pattern=DEFAULT_CLUSTER_FILE_PATTERN,
percentage_threshold=DEFAULT_THRESHOLD_PERCENTAGE,
lines_threshold=DEFAULT_THRESHOLD_LINES,
create_svg_files=DEFAULT_CREATE_SVG_FILES,
clusters_matches_csv_file=DEFAULT_CLUSTERS_MATCHES_CSV_FILE):
logutils.configure_level_and_format()
parser = argparse.ArgumentParser()
configure_cli_parser(parser)
args = parser.parse_args()
logutils.configure_level_and_format(args.log_level)
percentage_threshold=args.threshold_percentage
lines_threshold=args.threshold_lines
results = read_results_from_csv_file(results_csv_file)
graph = get_results_graph(results, percentage_threshold, lines_threshold)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment