Skip to content

Commit 240766a

Browse files
committed
Find the longest file path after removing root dir
1 parent 9438460 commit 240766a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

duplicate_code_detection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def run(fail_threshold, directories, files, ignore_directories, ignore_files,
129129
project_root_dir = os.path.join(
130130
project_root_dir, '') # Add the trailing slash
131131

132+
# Find the largest string length to format the textual output
133+
largest_string_length = len(max(source_code_files, key=len).replace(project_root_dir, ""))
134+
132135
# Parse the contents of all the source files
133136
source_code = OrderedDict()
134137
for source_code_file in source_code_files:
@@ -145,7 +148,6 @@ def run(fail_threshold, directories, files, ignore_directories, ignore_files,
145148
sims = gensim.similarities.Similarity(tempfile.gettempdir() + os.sep, tf_idf[corpus],
146149
num_features=len(dictionary))
147150

148-
largest_string_length = len(max(source_code_files, key=len))
149151
exit_code = ReturnCode.SUCCESS
150152
code_similarity = dict()
151153
for source_file in source_code:

0 commit comments

Comments
 (0)