forked from toadharvard/asm-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_clones.py
More file actions
executable file
·27 lines (21 loc) · 819 Bytes
/
Copy pathfind_clones.py
File metadata and controls
executable file
·27 lines (21 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
import sys
import os
LANG=sys.argv[1]
REPORTS_DIR="_reports"
REPORT_FILE="jscpd_report.txt"
def good_dir(d):
return os.path.isdir(os.path.join(".", d)) and not d.startswith('.') and d != LANG and d != REPORTS_DIR
if not os.path.exists("_reports"):
os.mkdir("_reports")
os.system("find . -iname _build -exec rm -fr {} \;")
NPM_BIN='/home/user/.local/bin'
for x in [x for x in os.listdir(".") if good_dir(x)]:
cmd = f"{NPM_BIN}/jscpd --pattern '{LANG}/**/*.ml*' --pattern '{x}/**/*.ml*' -b -r consoleFull --skipLocal > _reports/vs_{x}.txt"
print(cmd)
os.system(cmd)
if 1:
print("Looking for clones in itself");
cmd = f"{NPM_BIN}/jscpd --pattern '{LANG}/**/*.ml*' -b -r consoleFull > _reports/vs_{LANG}.txt"
os.system(cmd)
os.system(f"cat {REPORTS_DIR}/*.txt > {REPORT_FILE}")