mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
* Simplify invite_people email parsing Replace backwards in-place mutation loop with a straightforward forward filter into a new slice. Extract into parseEmailList so the logic can be unit tested directly. * MM-68150: Upgrade golangci-lint to v2.12.2 Remove //go:fix inline from NewPointer, which is a generic function not yet supported by the inline analyzer, and fix 11 slicesbackward modernize issues flagged by the new version. * MM-68150: Enable all linters by default; disable those with >20 existing issues Switch from opt-in (default: none) to opt-out (default: all) so new linters added to golangci-lint are evaluated automatically. Explicitly disable every linter that has more than 20 pre-existing violations, deferring those for later cleanup. Also disable a handful of linters whose violations are intentional patterns in this codebase (nilerr, dogsled, sqlclosecheck, iotamixing, predeclared, containedctx, iface, gocheckcompilerdirectives, promlinter, goprintffuncname, gomoddirectives). * MM-68150: Fix mirror linter issues Replace Write([]byte(s)) with WriteString(s), and FindIndex([]byte(s)) with FindStringIndex(s), to avoid unnecessary allocations. * MM-68150: Fix nosprintfhostport linter issue Use net.JoinHostPort to construct host:port strings instead of fmt.Sprintf with a manually formatted pattern. * MM-68150: Fix rowserrcheck and sqlclosecheck linter issues Check rows.Err() after iteration loops in schema_dump.go. In the sqlx_wrapper test, defer rows.Close() rather than closing inline. * MM-68150: Fix nilnesserr linter issues — wrong variable in error handlers In 11 places, a stale variable (often the outer err from a prior assignment) was used instead of the freshly-checked error variable (appErr, rowErr, jsonErr, writeErr, esErr). Each produces a typed-nil wrapped in a non-nil interface, silently discarding the real error. * MM-68150: Add i18n string for app.compile_csv_chunks.write_error --------- Co-authored-by: Mattermost Build <[email protected]>
73 lines
1.5 KiB
Go
73 lines
1.5 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package markdown
|
|
|
|
import (
|
|
"slices"
|
|
"strings"
|
|
)
|
|
|
|
type Paragraph struct {
|
|
blockBase
|
|
markdown string
|
|
|
|
Text []Range
|
|
ReferenceDefinitions []*ReferenceDefinition
|
|
}
|
|
|
|
func (b *Paragraph) ParseInlines(referenceDefinitions []*ReferenceDefinition) []Inline {
|
|
return ParseInlines(b.markdown, b.Text, referenceDefinitions)
|
|
}
|
|
|
|
func (b *Paragraph) Continuation(indentation int, r Range) *continuation {
|
|
s := b.markdown[r.Position:r.End]
|
|
if strings.TrimSpace(s) == "" {
|
|
return nil
|
|
}
|
|
return &continuation{
|
|
Indentation: indentation,
|
|
Remaining: r,
|
|
}
|
|
}
|
|
|
|
func (b *Paragraph) Close() {
|
|
for {
|
|
for i := 0; i < len(b.Text); i++ {
|
|
b.Text[i] = trimLeftSpace(b.markdown, b.Text[i])
|
|
if b.Text[i].Position < b.Text[i].End {
|
|
break
|
|
}
|
|
}
|
|
|
|
if len(b.Text) == 0 || b.Text[0].Position < b.Text[0].End && b.markdown[b.Text[0].Position] != '[' {
|
|
break
|
|
}
|
|
|
|
definition, remaining := parseReferenceDefinition(b.markdown, b.Text)
|
|
if definition == nil {
|
|
break
|
|
}
|
|
b.ReferenceDefinitions = append(b.ReferenceDefinitions, definition)
|
|
b.Text = remaining
|
|
}
|
|
|
|
for i, v := range slices.Backward(b.Text) {
|
|
b.Text[i] = trimRightSpace(b.markdown, v)
|
|
if b.Text[i].Position < b.Text[i].End {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
func newParagraph(markdown string, r Range) *Paragraph {
|
|
s := markdown[r.Position:r.End]
|
|
if strings.TrimSpace(s) == "" {
|
|
return nil
|
|
}
|
|
return &Paragraph{
|
|
markdown: markdown,
|
|
Text: []Range{r},
|
|
}
|
|
}
|