Skip to content

Commit

Permalink
Change requirement of threshold_combination_type in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Dec1mo committed Apr 5, 2021
1 parent f350dfc commit 13d3b1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scoss/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
help='Output directory.'
)
@click.option(
'--threshold-combination', '-tc', required=True,
'--threshold-combination', '-tc',
type=click.Choice(['AND','OR'], case_sensitive=False),
help='AND: All metrics are greater than threshold.\nOR: At least 1 metric is greater than threshold.'
)
Expand Down
4 changes: 3 additions & 1 deletion scoss/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def get_all_plagiarism(input_dir, output_dir, threshold_combination_type='AND',
set_operator_threshold == None and hash_operator_threshold == None:
print('Please choose at least 1 metric from [moss, count_operator, set_operator, hash_operator]', file=sys.stderr)
sys.exit(-1)
if not threshold_combination_type:
threshold_combination_type = 'AND'
all_files = get_all_files(input_dir)
output_dir = os.path.join(output_dir, 'plagiarism_report_{}/'.format(os.path.basename(os.path.normpath(input_dir))))
result_dir = os.path.join(output_dir, 'source_code_comparisons/')
Expand Down Expand Up @@ -98,7 +100,7 @@ def get_all_plagiarism(input_dir, output_dir, threshold_combination_type='AND',
problem_dir = os.path.basename(os.path.dirname(f))
sc.add_file(f, '{}_{}'.format(problem_dir, user_filename))
sc.run()
if threshold_combination_type == 'AND':
if threshold_combination_type.upper() == 'AND':
scoss_matches = sc.get_matches(or_thresholds=False, and_thresholds=True)
else: # Be careful
scoss_matches = sc.get_matches(or_thresholds=True, and_thresholds=False)
Expand Down

0 comments on commit 13d3b1f

Please sign in to comment.