Skip to content

Commit

Permalink
UPDATE: go lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fileformat committed Dec 10, 2023
1 parent dd5d234 commit 02779f0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/fflint/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestMain(m *testing.M) {
os.Exit(exitVal)
}

func Testfflint(t *testing.T) {
func TestFflint(t *testing.T) {
testscript.Run(t, testscript.Params{
Dir: "../../testdata",
})
Expand Down
1 change: 0 additions & 1 deletion internal/command/frontmatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
)

var (
fmReport bool
fmStrict bool
fmStrictSet map[string]bool
fmSorted bool
Expand Down
9 changes: 6 additions & 3 deletions internal/command/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package command
import (
"bytes"
"encoding/xml"
"fmt"

//"fmt"
"io"
"os"
//"os"

"github.com/FileFormatInfo/fflint/internal/shared"
"github.com/spf13/cobra"
"golang.org/x/net/html"
//"golang.org/x/net/html"
)

// htmlCmd represents the html command
Expand Down Expand Up @@ -71,6 +72,7 @@ func validateHTML(r *bytes.Reader) error {
}
}

/*
func hasErrorNodes(node *html.Node) bool {
if shared.Debug {
fmt.Fprintf(os.Stderr, "Node type=%d text=%d doc=%d\n", node.Type, html.TextNode, html.DocumentNode)
Expand All @@ -91,3 +93,4 @@ func hasErrorNodes(node *html.Node) bool {
}
return false
}
*/
4 changes: 2 additions & 2 deletions internal/command/svg.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func svgCheck(f *shared.FileContext) {
}
}

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

/* doesn't seem to work??? */
if svgForeign == false {
if !svgForeign {
foNodes := rootElement.FindAll("foreignObject")
if len(foNodes) > 0 {
f.RecordResult("svgForeignObject", false, map[string]interface{}{
Expand Down
5 changes: 1 addition & 4 deletions internal/command/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ func IsAsciiBytes(bytes []byte) error {
}

func IsAscii(b byte) bool {
if b > unicode.MaxASCII {
return false
}
return true
return b <= unicode.MaxASCII && !IsBadControl(b)
}

func IsBadControl(b byte) bool {
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ rm -rf ./fflint
go build -o ./fflint cmd/fflint/main.go
export PATH=$PATH:$(pwd)
fflint version
go test -timeout 30s -run "^Testfflint$" github.com/FileFormatInfo/fflint/cmd/fflint
go test -timeout 30s -run "^TestFflint$" github.com/FileFormatInfo/fflint/cmd/fflint
4 changes: 2 additions & 2 deletions testdata/json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ exec fflint json object.json
exec fflint json something.json
! exec fflint json trailingcomma.json

exec fflint json --schema=object.schema.json object.json --show-tests=all --debug
exec fflint json --schema=object.schema.json --show-tests=all string.json --debug
exec fflint json --schema=object.schema.json --show-tests=all --debug object.json
! exec fflint json --schema=object.schema.json --show-tests=all --debug string.json


-- toosmall.json --
Expand Down

0 comments on commit 02779f0

Please sign in to comment.