Skip to content

Commit 02779f0

Browse files
committed
UPDATE: go lint fixes
1 parent dd5d234 commit 02779f0

7 files changed

Lines changed: 13 additions & 14 deletions

File tree

cmd/fflint/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func TestMain(m *testing.M) {
8080
os.Exit(exitVal)
8181
}
8282

83-
func Testfflint(t *testing.T) {
83+
func TestFflint(t *testing.T) {
8484
testscript.Run(t, testscript.Params{
8585
Dir: "../../testdata",
8686
})

internal/command/frontmatter.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
)
1313

1414
var (
15-
fmReport bool
1615
fmStrict bool
1716
fmStrictSet map[string]bool
1817
fmSorted bool

internal/command/html.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package command
33
import (
44
"bytes"
55
"encoding/xml"
6-
"fmt"
6+
7+
//"fmt"
78
"io"
8-
"os"
9+
//"os"
910

1011
"github.com/FileFormatInfo/fflint/internal/shared"
1112
"github.com/spf13/cobra"
12-
"golang.org/x/net/html"
13+
//"golang.org/x/net/html"
1314
)
1415

1516
// htmlCmd represents the html command
@@ -71,6 +72,7 @@ func validateHTML(r *bytes.Reader) error {
7172
}
7273
}
7374

75+
/*
7476
func hasErrorNodes(node *html.Node) bool {
7577
if shared.Debug {
7678
fmt.Fprintf(os.Stderr, "Node type=%d text=%d doc=%d\n", node.Type, html.TextNode, html.DocumentNode)
@@ -91,3 +93,4 @@ func hasErrorNodes(node *html.Node) bool {
9193
}
9294
return false
9395
}
96+
*/

internal/command/svg.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func svgCheck(f *shared.FileContext) {
142142
}
143143
}
144144

145-
if svgText == false {
145+
if !svgText {
146146
textNodes := rootElement.FindAll("text")
147147
if len(textNodes) > 0 {
148148
f.RecordResult("svgText", false, map[string]interface{}{
@@ -153,7 +153,7 @@ func svgCheck(f *shared.FileContext) {
153153
}
154154

155155
/* doesn't seem to work??? */
156-
if svgForeign == false {
156+
if !svgForeign {
157157
foNodes := rootElement.FindAll("foreignObject")
158158
if len(foNodes) > 0 {
159159
f.RecordResult("svgForeignObject", false, map[string]interface{}{

internal/command/text.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ func IsAsciiBytes(bytes []byte) error {
9090
}
9191

9292
func IsAscii(b byte) bool {
93-
if b > unicode.MaxASCII {
94-
return false
95-
}
96-
return true
93+
return b <= unicode.MaxASCII && !IsBadControl(b)
9794
}
9895

9996
func IsBadControl(b byte) bool {

run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ rm -rf ./fflint
1111
go build -o ./fflint cmd/fflint/main.go
1212
export PATH=$PATH:$(pwd)
1313
fflint version
14-
go test -timeout 30s -run "^Testfflint$" github.com/FileFormatInfo/fflint/cmd/fflint
14+
go test -timeout 30s -run "^TestFflint$" github.com/FileFormatInfo/fflint/cmd/fflint

testdata/json.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ exec fflint json object.json
66
exec fflint json something.json
77
! exec fflint json trailingcomma.json
88

9-
exec fflint json --schema=object.schema.json object.json --show-tests=all --debug
10-
exec fflint json --schema=object.schema.json --show-tests=all string.json --debug
9+
exec fflint json --schema=object.schema.json --show-tests=all --debug object.json
10+
! exec fflint json --schema=object.schema.json --show-tests=all --debug string.json
1111

1212

1313
-- toosmall.json --

0 commit comments

Comments
 (0)