This repository was archived by the owner on Mar 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
93 lines (68 loc) · 2.44 KB
/
main.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import backend.git_ck_wrapper as git_ck
import backend.nicad_wrapper as nicad
import backend.sonarqube_wrapper as sonar
import backend.plotter as plotter
import backend.metrics_CSV_wrapper as metrics_CSV_wrapper
from xml.dom import minidom
import os
folder = "To_Analyze"
def check_repo():
"""
Metodo che controlla se il progetto da analizzare è presente
sul file system
:param folder: path della cartella da controllare
:return: "clone" del repository sul file system
"""
if os.path.exists(folder):
content = os.listdir(folder)
if content is not None:
return 0
else:
git_ck.clone_repo()
def check_folder():
"""
Metodo che controlla se la cartella di output è presente
sul file system
:return: creazione della cartella "output"
"""
if not os.path.exists("output"):
path = os.path.join("output")
os.mkdir(path)
def check_nicad_input():
"""
Metodo che controlla se la cartella "nicad_input" è presente
sul file system e ritorna il contenuto della cartella in una
lista per la sua succesiva iterazione
:return: "paths" lista dei file presenti nella cartella di input
"""
paths = []
file_path = os.path.abspath("nicad_input")
files = os.listdir(file_path)
for file in files:
paths.append("nicad_input/"+file)
return paths
if __name__ == '__main__':
#-----------------------------------------------INIIAL CHECK----------------//
try:
check_repo()
check_folder()
except:
print("Warning")
#----------------------------------------------------CK---------------------//
#git_ck.date_ck_metrics()
git_ck.all_ck_metrics()
git_ck.delete_unnecessary(file_to_keep="class")
metrics_CSV_wrapper.metrics_average()
plotter.graph_plot()
plotter.corr_matrix_plot()
#---------------------------------------------------NICAD-------------------//
for file in check_nicad_input():
fileToSend = file.replace("nicad_input/", "")
xml = minidom.parse(file)
nicad.xml_wrapper(fileToSend, xml)
#-------------------------------------------------SONARQUBE-----------------//
sonar.sonar()
#-------------------------------------------------PIE-CHART-----------------//
plotter.pie_chart()
#-------------------------------------------------HISTOGRAM-----------------//
plotter.bar_chart()