chore: publish IntegraCI build modules a11ec75d3e09

This commit is contained in:
dhimaz0445 committed 2026-11-11 03:41:55 +00:00
1 parent 694710104a
commit 3c2b80914e
78 files changed
+4982 -405

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
package main
import (
"encoding/json"
"fmt"
"sort"
)
// spectralCounts reads spectral's JSON report: [errors, warnings, info+hint].
// An empty report is a clean lint ("[]"); anything not a JSON array means
// spectral did not produce its report, which is an error (could_not_run).
func spectralCounts(report string) ([3]int, error) {
var out [3]int
var results []struct {
Severity int `json:"severity"`
}
if err := json.Unmarshal([]byte(report), &results); err != nil {
return out, fmt.Errorf("spectral report unreadable: %w", err)
}
for _, r := range results {
switch r.Severity {
case 0:
out[0]++
case 1:
out[1]++
default:
out[2]++
}
}
return out, nil
}
func sortedKeys(m map[string]string) []string {
out := make([]string, 0, len(m))
for k := range m {
out = append(out, k)
}
sort.Strings(out)
return out
}