MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / summarize_vale

Function summarize_vale

scripts/developer-guide/summarize_reports.py:130–165  ·  view source on GitHub ↗
(
    report: Path, status: str, summary_key: str, output: Path | None
)

Source from the content-addressed store, hash-verified

128
129
130def summarize_vale(
131 report: Path, status: str, summary_key: str, output: Path | None
132) -> None:
133 alerts: list[dict[str, object]] = []
134 if report.is_file():
135 try:
136 data = json.loads(report.read_text(encoding="utf-8"))
137 except json.JSONDecodeError:
138 data = {}
139 alerts = _collect_alerts(data)
140
141 counts = {"error": 0, "warning": 0, "suggestion": 0}
142 total = 0
143 for alert in alerts:
144 if not isinstance(alert, dict):
145 continue
146 severity = str(alert.get("Severity", "")).lower()
147 if severity in counts:
148 counts[severity] += 1
149 total += 1
150
151 if total:
152 parts = [
153 f"{counts['error']} errors",
154 f"{counts['warning']} warnings",
155 f"{counts['suggestion']} suggestions",
156 ]
157 summary = f"{total} alert(s) ({', '.join(parts)})"
158 if _has_nonzero_status(status):
159 summary += f" (exit code {_normalize_status(status)})"
160 elif _has_nonzero_status(status):
161 summary = f"Vale failed (exit code {_normalize_status(status)})"
162 else:
163 summary = "No alerts found"
164
165 write_outputs([(summary_key, summary)], output)
166
167
168def summarize_paragraph_capitalization(

Callers 1

mainFunction · 0.85

Calls 7

_has_nonzero_statusFunction · 0.85
_normalize_statusFunction · 0.85
write_outputsFunction · 0.85
_collect_alertsFunction · 0.70
lowerMethod · 0.65
getMethod · 0.65
joinMethod · 0.65

Tested by

no test coverage detected