Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mossutils
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dinfk-lecturers
mossutils
Commits
003c781d
Commit
003c781d
authored
Nov 05, 2020
by
scmalte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cluster.py: added command-line options for thresholds
parent
89930c09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
mossutils/cluster.py
mossutils/cluster.py
+22
-4
No files found.
mossutils/cluster.py
View file @
003c781d
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment