Add wsl linter and fix

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 14:51:08 +04:00
parent eedfdcecc8
commit 9156d6a16a
882 changed files with 6068 additions and 574 deletions

View File

@@ -65,6 +65,7 @@ func sortConsentCategories(categories coredata.CookieCategories) {
if d := snapshotCategoryKindOrder(a.Kind) - snapshotCategoryKindOrder(b.Kind); d != 0 {
return d
}
return bytes.Compare(a.ID[:], b.ID[:])
})
}
@@ -77,10 +78,12 @@ func buildSnapshot(
sortConsentCategories(categories)
cookiesByCategory := make(map[gid.GID]coredata.CookieItems)
for _, p := range allPatterns {
if p.TrackerType != coredata.TrackerTypeCookie {
continue
}
cookiesByCategory[p.CookieCategoryID] = append(
cookiesByCategory[p.CookieCategoryID],
coredata.CookieItem{
@@ -97,10 +100,12 @@ func buildSnapshot(
if cookies == nil {
cookies = coredata.CookieItems{}
}
gcmConsentTypes := c.GCMConsentTypes
if gcmConsentTypes == nil {
gcmConsentTypes = []string{}
}
snapshotCategories[i] = coredata.CookieBannerVersionSnapshotCategory{
Name: c.Name,
Slug: c.Slug,
@@ -138,15 +143,19 @@ func buildSnapshotTranslations(
Description string `json:"description"`
} `json:"categories"`
}
_ = json.Unmarshal(t.Translations, &raw)
ui := make(map[string]string)
var flat map[string]json.RawMessage
_ = json.Unmarshal(t.Translations, &flat)
for k, v := range flat {
if k == "categories" || k == "cookies" {
continue
}
var s string
if json.Unmarshal(v, &s) == nil {
ui[k] = s
@@ -161,9 +170,11 @@ func buildSnapshotTranslations(
Name: ct.Name,
Description: ct.Description,
}
continue
}
}
catTranslations[i] = coredata.CookieBannerVersionSnapshotCategoryTranslation{
Name: c.Name,
Description: c.Description,