From 15d7c9e118b4f7f1adc6b190a518f5823c82ed78 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Thu, 25 Nov 2021 10:24:51 +0100 Subject: [PATCH] enable misspell linter --- .golangci.yml | 1 + cmd/utils.go | 2 +- pkg/yqlib/expression_postfix.go | 2 +- pkg/yqlib/file_utils.go | 2 +- pkg/yqlib/operator_equals_test.go | 2 +- pkg/yqlib/operator_load.go | 2 +- pkg/yqlib/operator_multiply.go | 2 +- pkg/yqlib/operator_strings_test.go | 2 +- pkg/yqlib/operator_traverse_path.go | 4 ++-- pkg/yqlib/utils.go | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index ae6360a8..ae8999ed 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,6 +6,7 @@ linters: - gofmt - goimports - gosec + - misspell issues: exclude-rules: - linters: diff --git a/cmd/utils.go b/cmd/utils.go index 80a2b295..483ea426 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -25,7 +25,7 @@ func initCommand(cmd *cobra.Command, args []string) (firstFileIndex int, err err firstFileIndex = 1 } - // backwards compatibilty + // backwards compatibility if outputToJSON { outputFormat = "json" } diff --git a/pkg/yqlib/expression_postfix.go b/pkg/yqlib/expression_postfix.go index e237f888..f9938680 100644 --- a/pkg/yqlib/expression_postfix.go +++ b/pkg/yqlib/expression_postfix.go @@ -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 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 // hack - see if there's the optional traverse flag diff --git a/pkg/yqlib/file_utils.go b/pkg/yqlib/file_utils.go index 7668a8e1..7a423720 100644 --- a/pkg/yqlib/file_utils.go +++ b/pkg/yqlib/file_utils.go @@ -34,7 +34,7 @@ func tryRemoveFile(filename string) { // thanks https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang 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. in, err := os.Open(src) // #nosec diff --git a/pkg/yqlib/operator_equals_test.go b/pkg/yqlib/operator_equals_test.go index 1064ebd3..69cd6e09 100644 --- a/pkg/yqlib/operator_equals_test.go +++ b/pkg/yqlib/operator_equals_test.go @@ -173,7 +173,7 @@ var equalsOperatorScenarios = []expressionScenario{ }, }, { - description: "Two non existant keys are equal", + description: "Two non existent keys are equal", document: "a: frog", expression: `select(.b == .c)`, expected: []string{ diff --git a/pkg/yqlib/operator_load.go b/pkg/yqlib/operator_load.go index 2c3be798..4741b09a 100644 --- a/pkg/yqlib/operator_load.go +++ b/pkg/yqlib/operator_load.go @@ -15,7 +15,7 @@ type loadPrefs struct { } 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. filebytes, err := ioutil.ReadFile(filename) // #nosec diff --git a/pkg/yqlib/operator_multiply.go b/pkg/yqlib/operator_multiply.go index d7bec73d..a60f0287 100644 --- a/pkg/yqlib/operator_multiply.go +++ b/pkg/yqlib/operator_multiply.go @@ -42,7 +42,7 @@ func multiply(preferences multiplyPreferences) func(d *dataTreeNavigator, contex leadingContent, headComment, footComment := getComments(lhs, rhs) lhs.Node = unwrapDoc(lhs.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) if lhs.Node.Kind == yaml.MappingNode && rhs.Node.Kind == yaml.MappingNode || diff --git a/pkg/yqlib/operator_strings_test.go b/pkg/yqlib/operator_strings_test.go index f1218010..c94a2fc8 100644 --- a/pkg/yqlib/operator_strings_test.go +++ b/pkg/yqlib/operator_strings_test.go @@ -99,7 +99,7 @@ var stringsOperatorScenarios = []expressionScenario{ }, { 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"]`, expression: `.[] | test("at")`, expected: []string{ diff --git a/pkg/yqlib/operator_traverse_path.go b/pkg/yqlib/operator_traverse_path.go index e02c388e..08c36e5b 100644 --- a/pkg/yqlib/operator_traverse_path.go +++ b/pkg/yqlib/operator_traverse_path.go @@ -42,7 +42,7 @@ func traverse(d *dataTreeNavigator, context Context, matchingNode *CandidateNode if value.Tag == "!!null" && operation.Value != "[]" { 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) { case int, int64: log.Debugf("probably an array") @@ -87,7 +87,7 @@ func traverseArrayOperator(d *dataTreeNavigator, context Context, expressionNode 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) diff --git a/pkg/yqlib/utils.go b/pkg/yqlib/utils.go index f992116e..aa514770 100644 --- a/pkg/yqlib/utils.go +++ b/pkg/yqlib/utils.go @@ -17,7 +17,7 @@ func readStream(filename string, leadingContentPreProcessing bool) (io.Reader, s if filename == "-" { reader = bufio.NewReader(os.Stdin) } 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. file, err := os.Open(filename) // #nosec if err != nil {