-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetrics.py
More file actions
31 lines (24 loc) · 818 Bytes
/
Copy pathmetrics.py
File metadata and controls
31 lines (24 loc) · 818 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
28
29
30
31
from collections import Counter
class TraceMetrics:
def score(self, trace, failures):
score = 100
penalty_map = {
"retry_loop": 20,
"uncertain_fix": 10,
"failing_tests": 25,
"incomplete_fix": 15,
}
for failure in failures:
score -= penalty_map.get(failure["type"], 5)
return max(score, 0)
def cluster_failures(self, failures):
counts = Counter(f["type"] for f in failures)
return dict(counts)
def render_clusters(self, clusters):
print("\n=== Failure Clusters ===")
if not clusters:
print("No clusters detected.")
return
for name, count in clusters.items():
bar = "#" * count
print(f"{name:16} {bar} ({count})")