-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrace.py
More file actions
65 lines (56 loc) · 2.23 KB
/
Copy pathtrace.py
File metadata and controls
65 lines (56 loc) · 2.23 KB
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
import sys
sys.path.insert(0, "/home/tom/github/semcod/llx")
def test():
from llx.planfile.generate_strategy import _normalize_strategy_data
focus = "complexity"
data = {
"name": "Refactoring Strategy",
"project_type": "python",
"domain": "software",
"goal": focus or "improvement",
"sprints": [
{
"id": 1,
"name": "Sprint 1",
"objectives": ["Reduce complexity", "Add tests"],
"tasks": [
{
"name": "Analyze Complexity",
"description": "Analyze code complexity",
"type": "feature",
"model_hints": "balanced",
},
{
"name": "Add Tests",
"description": "Add unit tests",
"type": "test",
"model_hints": "cheap",
},
],
}
],
"quality_gates": ["Average CC < 5", "Test coverage >= 80%"],
}
data = _normalize_strategy_data(data)
if "name" not in data:
data["name"] = "Refactoring Strategy"
if "project_type" not in data:
data["project_type"] = "python"
if "domain" not in data:
data["domain"] = "software"
if "goal" not in data or isinstance(data.get("goal"), str):
goal_str = data.get("goal", focus or "improvement")
data["goal"] = {
"short": f"Improve {goal_str}" if goal_str else "Improve codebase",
"quality": ["Reduce complexity", "Improve maintainability"],
"delivery": ["Complete in sprints", "Review changes"],
"metrics": ["Complexity reduction", "Test coverage"],
}
elif isinstance(data.get("goal"), dict):
goal = data["goal"]
goal.setdefault("short", f"Improve {focus or 'codebase'}")
goal.setdefault("quality", ["Reduce complexity", "Improve maintainability"])
goal.setdefault("delivery", ["Complete in sprints", "Review changes"])
goal.setdefault("metrics", ["Complexity reduction", "Test coverage"])
test()
print("Test completed successfully without 'get' error.")