Skip to content

Commit

Permalink
chore: fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DStrand1 committed Feb 4, 2025
1 parent 365f4b7 commit b1c0c5f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/license_checker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ func main() {
for lineElementNode := lineRoot.FirstChild().FirstChild(); lineElementNode != nil; lineElementNode = lineElementNode.NextSibling() {
switch v := lineElementNode.(type) {
case *ast.Text:
name += string(v.Text(line))
name += string(v.Value(line))
case *ast.Link:
license = string(v.Text(line))
license = string(v.FirstChild().(*ast.Text).Value(line))
link = string(v.Destination)
default:
debugf("ignoring unknown element %T (%v)", v, v)
Expand Down
3 changes: 2 additions & 1 deletion tools/readme_config_includer/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func main() {
if lines.Len() > 0 {
stop = lines.At(lines.Len() - 1).Stop
}
txt = node.Info.Text(readme)
txt = node.Info.Value(readme)
re = tomlIncludesEx
case *ast.Heading:
if node.ChildCount() < 2 {
Expand All @@ -186,6 +186,7 @@ func main() {
if rawnode.Lines().Len() > 0 {
stop = rawnode.Lines().At(0).Start - h.Level - 1
} else {
//nolint:staticcheck // need to use this since we aren't sure the type
log.Printf("heading without lines: %s", string(rawnode.Text(readme)))
stop = start // safety measure to prevent removing all text
}
Expand Down
1 change: 1 addition & 0 deletions tools/readme_linter/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (t *T) assertFirstChildRegexp(expectedPattern string, n ast.Node) {
}
c := n.FirstChild()

//nolint:staticcheck // need to use this since we aren't sure the type
actual := string(c.Text(t.markdown))

if !validRegexp.MatchString(actual) {
Expand Down
4 changes: 3 additions & 1 deletion tools/readme_linter/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func firstSection(t *T, root ast.Node) error {
// Make sure there is some text after the heading
n = n.NextSibling()
t.assertKind(ast.KindParagraph, n)
length := len(n.Text(t.markdown))
length := len(n.(*ast.Paragraph).Lines().Value(t.markdown))
if length < 30 {
t.assertNodef(n, "short first section. Please add short description of plugin. length %d, minimum 30", length)
}
Expand Down Expand Up @@ -62,6 +62,7 @@ func requiredSections(t *T, root ast.Node, headings []string) error {
if child == nil {
continue
}
//nolint:staticcheck // need to use this since we aren't sure the type
title := strings.TrimSpace(string(child.Text(t.markdown)))
if headingsSet.has(title) && h.Level != expectedLevel {
t.assertNodef(n, "has required section %q but wrong heading level. Expected level %d, found %d",
Expand Down Expand Up @@ -155,6 +156,7 @@ func configSection(t *T, root ast.Node) error {
continue
}

//nolint:staticcheck // need to use this since we aren't sure the type
title := string(h.FirstChild().Text(t.markdown))
if title == expectedTitle {
config = h
Expand Down

0 comments on commit b1c0c5f

Please sign in to comment.