enable misspell linter

This commit is contained in:
Matthieu MOREL 2021-11-25 10:24:51 +01:00 committed by Mike Farah
parent 3e82171f18
commit 15d7c9e118
10 changed files with 11 additions and 10 deletions

View File

@ -6,6 +6,7 @@ linters:
- gofmt - gofmt
- goimports - goimports
- gosec - gosec
- misspell
issues: issues:
exclude-rules: exclude-rules:
- linters: - linters:

View File

@ -25,7 +25,7 @@ func initCommand(cmd *cobra.Command, args []string) (firstFileIndex int, err err
firstFileIndex = 1 firstFileIndex = 1
} }
// backwards compatibilty // backwards compatibility
if outputToJSON { if outputToJSON {
outputFormat = "json" outputFormat = "json"
} }

View File

@ -68,7 +68,7 @@ func (p *expressionPostFixerImpl) ConvertToPostfix(infixTokens []*token) ([]*Ope
} }
// now we should have [ as the last element on the opStack, get rid of it // now we should have [ as the last element on the opStack, get rid of it
opStack = opStack[0 : len(opStack)-1] opStack = opStack[0 : len(opStack)-1]
log.Debugf("deleteing open bracket from opstack") log.Debugf("deleting open bracket from opstack")
//and append a collect to the result //and append a collect to the result
// hack - see if there's the optional traverse flag // hack - see if there's the optional traverse flag

View File

@ -34,7 +34,7 @@ func tryRemoveFile(filename string) {
// thanks https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang // thanks https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang
func copyFileContents(src, dst string) (err error) { func copyFileContents(src, dst string) (err error) {
// ignore CWE-22 gosec issue - that's more targetted for http based apps that run in a public directory, // ignore CWE-22 gosec issue - that's more targeted for http based apps that run in a public directory,
// and ensuring that it's not possible to give a path to a file outside thar directory. // and ensuring that it's not possible to give a path to a file outside thar directory.
in, err := os.Open(src) // #nosec in, err := os.Open(src) // #nosec

View File

@ -173,7 +173,7 @@ var equalsOperatorScenarios = []expressionScenario{
}, },
}, },
{ {
description: "Two non existant keys are equal", description: "Two non existent keys are equal",
document: "a: frog", document: "a: frog",
expression: `select(.b == .c)`, expression: `select(.b == .c)`,
expected: []string{ expected: []string{

View File

@ -15,7 +15,7 @@ type loadPrefs struct {
} }
func loadString(filename string) (*CandidateNode, error) { func loadString(filename string) (*CandidateNode, error) {
// ignore CWE-22 gosec issue - that's more targetted for http based apps that run in a public directory, // ignore CWE-22 gosec issue - that's more targeted for http based apps that run in a public directory,
// and ensuring that it's not possible to give a path to a file outside that directory. // and ensuring that it's not possible to give a path to a file outside that directory.
filebytes, err := ioutil.ReadFile(filename) // #nosec filebytes, err := ioutil.ReadFile(filename) // #nosec

View File

@ -42,7 +42,7 @@ func multiply(preferences multiplyPreferences) func(d *dataTreeNavigator, contex
leadingContent, headComment, footComment := getComments(lhs, rhs) leadingContent, headComment, footComment := getComments(lhs, rhs)
lhs.Node = unwrapDoc(lhs.Node) lhs.Node = unwrapDoc(lhs.Node)
rhs.Node = unwrapDoc(rhs.Node) rhs.Node = unwrapDoc(rhs.Node)
log.Debugf("Multipling LHS: %v", lhs.Node.Tag) log.Debugf("Multiplying LHS: %v", lhs.Node.Tag)
log.Debugf("- RHS: %v", rhs.Node.Tag) log.Debugf("- RHS: %v", rhs.Node.Tag)
if lhs.Node.Kind == yaml.MappingNode && rhs.Node.Kind == yaml.MappingNode || if lhs.Node.Kind == yaml.MappingNode && rhs.Node.Kind == yaml.MappingNode ||

View File

@ -99,7 +99,7 @@ var stringsOperatorScenarios = []expressionScenario{
}, },
{ {
description: "Test using regex", description: "Test using regex",
subdescription: "Like jq'q equivalant, this works like match but only returns true/false instead of full match details", subdescription: "Like jq'q equivalent, this works like match but only returns true/false instead of full match details",
document: `["cat", "dog"]`, document: `["cat", "dog"]`,
expression: `.[] | test("at")`, expression: `.[] | test("at")`,
expected: []string{ expected: []string{

View File

@ -42,7 +42,7 @@ func traverse(d *dataTreeNavigator, context Context, matchingNode *CandidateNode
if value.Tag == "!!null" && operation.Value != "[]" { if value.Tag == "!!null" && operation.Value != "[]" {
log.Debugf("Guessing kind") log.Debugf("Guessing kind")
// we must ahve added this automatically, lets guess what it should be now // we must have added this automatically, lets guess what it should be now
switch operation.Value.(type) { switch operation.Value.(type) {
case int, int64: case int, int64:
log.Debugf("probably an array") log.Debugf("probably an array")
@ -87,7 +87,7 @@ func traverseArrayOperator(d *dataTreeNavigator, context Context, expressionNode
return Context{}, err return Context{}, err
} }
// rhs is a collect expression that will yield indexes to retreive of the arrays // rhs is a collect expression that will yield indexes to retrieve of the arrays
rhs, err := d.GetMatchingNodes(context.ReadOnlyClone(), expressionNode.Rhs) rhs, err := d.GetMatchingNodes(context.ReadOnlyClone(), expressionNode.Rhs)

View File

@ -17,7 +17,7 @@ func readStream(filename string, leadingContentPreProcessing bool) (io.Reader, s
if filename == "-" { if filename == "-" {
reader = bufio.NewReader(os.Stdin) reader = bufio.NewReader(os.Stdin)
} else { } else {
// ignore CWE-22 gosec issue - that's more targetted for http based apps that run in a public directory, // ignore CWE-22 gosec issue - that's more targeted for http based apps that run in a public directory,
// and ensuring that it's not possible to give a path to a file outside thar directory. // and ensuring that it's not possible to give a path to a file outside thar directory.
file, err := os.Open(filename) // #nosec file, err := os.Open(filename) // #nosec
if err != nil { if err != nil {