-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport_generator.py
More file actions
158 lines (131 loc) · 4.55 KB
/
report_generator.py
File metadata and controls
158 lines (131 loc) · 4.55 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/env python3
"""
report_generator.py
Usage:
python3 report_generator.py results.json
Output:
- For each repo: Programming languages, Frameworks & Libraries, Development Tools
- Final aggregated lists: Languages, Frameworks & Libraries, Development Tools, All detected skills
By the provided repo_skill_scanner.py, this assumes results.json was produced and contains:
- repo_name
- languages
- accepted_skills_by_category
- possible_skills_by_category
- candidate_skills_by_category
- evidence (optional)
"""
import sys
import json
from collections import defaultdict
if len(sys.argv) < 2:
print("Usage: python3 report_generator.py results.json")
sys.exit(1)
fn = sys.argv[1]
data = json.load(open(fn, 'r', encoding='utf-8'))
# Categories we treat as "Frameworks & Libraries"
FRAMEWORK_CATEGORIES = {
"ML/AI", "Web & APIs", "Frontend", "Data & Analysis", "Data & Big Data",
"Frameworks", "Libraries"
}
# Categories we treat as "Development Tools"
DEVTOOL_CATEGORIES = {
"Dev Tools", "CI/CD", "Build & Packaging", "Containers & Orchestration",
"Cloud", "Testing", "Security / Auth", "Databases", "Messaging / Streaming",
"Performance / GPU", "Serialization / RPC", "Other"
}
# If the scanner used different category names, this set can be expanded.
# Collect aggregated sets
agg_languages = set()
agg_frameworks = set()
agg_devtools = set()
agg_all_skills = set()
agg_possible = set()
def collect_skills_by_categories(skill_map, categories):
s = set()
for cat, skills in skill_map.items():
if cat in categories:
s.update(skills)
return s
repos = data.get("repos", [])
print("\nDETAILED PER-REPO REPORT\n" + "="*60)
for r in repos:
name = r.get("repo_name") or r.get("repo_url")
print(f"\nRepository: {name}")
# Languages
langs = r.get("languages") or []
print(" Programming languages:")
if langs:
for L in langs:
print(" -", L)
else:
print(" - (none detected)")
agg_languages.update(langs)
# Accepted skills (strong)
accepted = r.get("accepted_skills_by_category", {}) or r.get("accepted", {})
possible = r.get("possible_skills_by_category", {}) or r.get("possible", {})
frameworks = collect_skills_by_categories(accepted, FRAMEWORK_CATEGORIES)
devtools = collect_skills_by_categories(accepted, DEVTOOL_CATEGORIES)
# If accepted is empty for certain categories, include possible as "possible"
possible_frameworks = collect_skills_by_categories(possible, FRAMEWORK_CATEGORIES)
possible_devtools = collect_skills_by_categories(possible, DEVTOOL_CATEGORIES)
# Print frameworks & libraries
print(" Frameworks & Libraries (confirmed):")
if frameworks:
for f in sorted(frameworks):
print(" -", f)
else:
print(" - (none confirmed)")
if possible_frameworks:
print(" Frameworks & Libraries (possible/unconfirmed):")
for f in sorted(possible_frameworks):
print(" -", f)
# Print dev tools
print(" Development tools (confirmed):")
if devtools:
for d in sorted(devtools):
print(" -", d)
else:
print(" - (none confirmed)")
if possible_devtools:
print(" Development tools (possible/unconfirmed):")
for d in sorted(possible_devtools):
print(" -", d)
# Add to aggregates
agg_frameworks.update(frameworks)
agg_devtools.update(devtools)
agg_all_skills.update(frameworks)
agg_all_skills.update(devtools)
# also include accepted skills from all categories
for cat, skills in (accepted or {}).items():
agg_all_skills.update(skills)
for cat, skills in (possible or {}).items():
agg_possible.update(skills)
print("\n" + "="*60)
print("AGGREGATED SUMMARY (ACROSS ALL REPOS)\n")
print("Programming languages:")
if agg_languages:
for L in sorted(agg_languages):
print(" -", L)
else:
print(" - (none detected)")
print("\nFrameworks & Libraries (confirmed):")
if agg_frameworks:
for f in sorted(agg_frameworks):
print(" -", f)
else:
print(" - (none detected)")
print("\nDevelopment tools (confirmed):")
if agg_devtools:
for d in sorted(agg_devtools):
print(" -", d)
else:
print(" - (none detected)")
# Everything used (confirmed + possible)
# all_used = set(agg_all_skills) | set(agg_possible)
# print("\nEverything detected (confirmed + possible/unconfirmed):")
# if all_used:
# for s in sorted(all_used):
# print(" -", s)
# else:
# print(" - (none detected)")
print("\nReport generation complete.")