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

@@ -49,24 +49,29 @@ var (
if b == nil {
return ""
}
if *b {
return "yes"
}
return "no"
},
"derefString": func(s *string) string {
if s == nil {
return ""
}
return *s
},
"boolToYesNoDash": func(b *bool) string {
if b == nil {
return "-"
}
if *b {
return "Yes"
}
return "No"
},
"imgTag": func(src, alt, class string) template.HTML {
@@ -106,6 +111,7 @@ var (
if safeguard == nil {
return ""
}
switch *safeguard {
case coredata.ProcessingActivityTransferSafeguardStandardContractualClauses:
return "Standard Contractual Clauses"
@@ -157,6 +163,7 @@ var (
if risk == nil {
return ""
}
switch *risk {
case coredata.DataProtectionImpactAssessmentResidualRiskLow:
return "Low"
@@ -468,6 +475,7 @@ func BoolLabel(v bool) string {
if v {
return "Yes"
}
return "No"
}
@@ -486,6 +494,7 @@ func MaturityLabel(l coredata.ControlMaturityLevel) string {
case coredata.ControlMaturityLevelOptimizing:
return "5 - Optimizing"
}
return "Not set"
}
@@ -503,14 +512,17 @@ func ProseMirrorJSONToHTML(content json.RawMessage) template.HTML {
if s == "" {
return template.HTML("")
}
node, err := prosemirror.Parse(s)
if err != nil {
return template.HTML(fmt.Sprintf("<p>%s</p>", html.EscapeString(s)))
}
htmlStr, err := prosemirror.RenderHTML(node)
if err != nil {
return template.HTML(fmt.Sprintf("<p>%s</p>", html.EscapeString(s)))
}
return template.HTML(htmlStr)
}

View File

@@ -396,10 +396,12 @@ func TestDocumentVersionSignatureStates(t *testing.T) {
func TestLargeContent(t *testing.T) {
var largeContent strings.Builder
largeContent.WriteString(`{"type":"doc","content":[`)
for i := range 1000 {
if i > 0 {
largeContent.WriteByte(',')
}
largeContent.WriteString(`{"type":"heading","attrs":{"level":1},"content":[{"type":"text","text":"Section `)
largeContent.WriteByte(byte('A' + i%26))
largeContent.WriteString(`"}]},`)
@@ -416,6 +418,7 @@ func TestLargeContent(t *testing.T) {
`{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"List item 3"}]}]}` +
`]}`)
}
largeContent.WriteString(`]}`)
data := DocumentData{
@@ -465,6 +468,7 @@ func BenchmarkGenerateHTML(b *testing.B) {
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := RenderHTML(data)
if err != nil {