From cdb9b56066e698de711e8284b9abf624760051a3 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Tue, 19 Sep 2023 09:52:36 +1000 Subject: [PATCH] Spellig with cspell --- Makefile | 6 +- README.md | 8 +- acceptance_tests/bad_args.sh | 8 +- acceptance_tests/basic.sh | 6 +- acceptance_tests/leading-seperator.sh | 50 ++--- cmd/evaluate_all_command.go | 2 +- cmd/evalute_sequence_command.go | 2 +- cmd/root.go | 2 +- cmd/unwrap_flag.go | 12 +- cmd/utils.go | 6 +- cspell.config.yaml | 14 ++ pkg/yqlib/decoder_yaml.go | 2 +- pkg/yqlib/doc/operators/group-by.md | 2 +- pkg/yqlib/doc/operators/headers/Main.md | 2 +- pkg/yqlib/doc/usage/shellvariables.md | 4 +- pkg/yqlib/encoder_lua.go | 2 +- pkg/yqlib/encoder_properties.go | 2 +- pkg/yqlib/encoder_yaml.go | 2 +- pkg/yqlib/lexer_participle.go | 4 +- pkg/yqlib/operator_comments.go | 8 +- pkg/yqlib/operator_datetime.go | 8 +- pkg/yqlib/operator_group_by_test.go | 2 +- pkg/yqlib/operator_keys.go | 4 +- pkg/yqlib/operator_pick.go | 2 +- pkg/yqlib/operator_traverse_path.go | 2 +- pkg/yqlib/printer.go | 2 +- pkg/yqlib/printer_test.go | 20 +- pkg/yqlib/shellvariables_test.go | 8 +- pkg/yqlib/write_in_place_handler.go | 2 +- pkg/yqlib/xml_test.go | 4 +- project-words.txt | 253 ++++++++++++++++++++++++ scripts/extract-checksum.sh | 4 +- scripts/generate-man-page-md.sh | 2 +- scripts/generate-man-page.sh | 2 +- scripts/release-deb.sh | 2 +- scripts/spelling.sh | 3 + 36 files changed, 369 insertions(+), 95 deletions(-) create mode 100644 cspell.config.yaml create mode 100644 project-words.txt create mode 100755 scripts/spelling.sh diff --git a/Makefile b/Makefile index a186d5a8..42c11fb2 100644 --- a/Makefile +++ b/Makefile @@ -84,8 +84,12 @@ format: vendor ${ENGINERUN} bash ./scripts/format.sh +.PHONY: spelling +spelling: format + ${ENGINERUN} bash ./scripts/spelling.sh + .PHONY: secure -secure: format +secure: spelling ${ENGINERUN} bash ./scripts/secure.sh .PHONY: check diff --git a/README.md b/README.md index 7bed4fbb..06096704 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Pipe from STDIN: yq '.a.b[0].c' < file.yaml ``` -Update a yaml file, inplace +Update a yaml file, in place ```bash yq -i '.a.b[0].c = "cool"' file.yaml ``` @@ -310,7 +310,7 @@ https://pkgs.alpinelinux.org/package/edge/community/x86/yq - [Deeply data structures](https://mikefarah.gitbook.io/yq/operators/traverse-read) - [Sort keys](https://mikefarah.gitbook.io/yq/operators/sort-keys) - Manipulate yaml [comments](https://mikefarah.gitbook.io/yq/operators/comment-operators), [styling](https://mikefarah.gitbook.io/yq/operators/style), [tags](https://mikefarah.gitbook.io/yq/operators/tag) and [anchors and aliases](https://mikefarah.gitbook.io/yq/operators/anchor-and-alias-operators). -- [Update inplace](https://mikefarah.gitbook.io/yq/v/v4.x/commands/evaluate#flags) +- [Update in place](https://mikefarah.gitbook.io/yq/v/v4.x/commands/evaluate#flags) - [Complex expressions to select and update](https://mikefarah.gitbook.io/yq/operators/select#select-and-update-matching-values-in-map) - Keeps yaml formatting and comments when updating (though there are issues with whitespace) - [Decode/Encode base64 data](https://mikefarah.gitbook.io/yq/operators/encode-decode) @@ -337,7 +337,7 @@ Examples: # yq defaults to 'eval' command if no command is specified. See "yq eval --help" for more examples. yq '.stuff' < myfile.yml # outputs the data at the "stuff" node from "myfile.yml" -yq -i '.stuff = "foo"' myfile.yml # update myfile.yml inplace +yq -i '.stuff = "foo"' myfile.yml # update myfile.yml in place Available Commands: @@ -354,7 +354,7 @@ Flags: --header-preprocess Slurp any header comments and separators before processing expression. (default true) -h, --help help for yq -I, --indent int sets indent level for output (default 2) - -i, --inplace update the file inplace of first file given. + -i, --inplace update the file in place of first file given. -p, --input-format string [yaml|y|xml|x] parse format for input. Note that json is a subset of yaml. (default "yaml") -M, --no-colors force print with no colors -N, --no-doc Don't print document separators (---) diff --git a/acceptance_tests/bad_args.sh b/acceptance_tests/bad_args.sh index 34d43b6e..c5ac76db 100755 --- a/acceptance_tests/bad_args.sh +++ b/acceptance_tests/bad_args.sh @@ -3,25 +3,25 @@ testWriteInPlacePipeIn() { result=$(./yq e -i -n '.a' 2>&1) assertEquals 1 $? - assertEquals "Error: write inplace flag only applicable when giving an expression and at least one file" "$result" + assertEquals "Error: write in place flag only applicable when giving an expression and at least one file" "$result" } testWriteInPlacePipeInEvalall() { result=$(./yq ea -i -n '.a' 2>&1) assertEquals 1 $? - assertEquals "Error: write inplace flag only applicable when giving an expression and at least one file" "$result" + assertEquals "Error: write in place flag only applicable when giving an expression and at least one file" "$result" } testWriteInPlaceWithSplit() { result=$(./yq e -s "cat" -i '.a = "thing"' test.yml 2>&1) assertEquals 1 $? - assertEquals "Error: write inplace cannot be used with split file" "$result" + assertEquals "Error: write in place cannot be used with split file" "$result" } testWriteInPlaceWithSplitEvalAll() { result=$(./yq ea -s "cat" -i '.a = "thing"' test.yml 2>&1) assertEquals 1 $? - assertEquals "Error: write inplace cannot be used with split file" "$result" + assertEquals "Error: write in place cannot be used with split file" "$result" } testNullWithFiles() { diff --git a/acceptance_tests/basic.sh b/acceptance_tests/basic.sh index 141122c4..5705ea53 100755 --- a/acceptance_tests/basic.sh +++ b/acceptance_tests/basic.sh @@ -143,7 +143,7 @@ testBasicCatWithFilesNoDash() { } # when the nullinput flag is used -# dont automatically read STDIN (this breaks github actions) +# don't automatically read STDIN (this breaks github actions) testBasicCreateFileGithubAction() { cat /dev/null | ./yq -n ".a = 123" > test.yml } @@ -302,7 +302,7 @@ testBasicExitStatusNoEval() { assertEquals 1 "$?" } -testBasicExtractFieldWithSeperator() { +testBasicExtractFieldWithSeparator() { cat >test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml <test.yml < 0 { @@ -104,7 +104,7 @@ func initCommand(cmd *cobra.Command, args []string) (string, []string, error) { outputFormatType == yqlib.PropsOutputFormat { unwrapScalar = true } - if unwrapScalarFlag.IsExplicitySet() { + if unwrapScalarFlag.IsExplicitlySet() { unwrapScalar = unwrapScalarFlag.IsSet() } diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 00000000..99ef61e1 --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,14 @@ +--- +$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json +version: '0.2' +language: en-GB +dictionaryDefinitions: + - name: project-words + path: './project-words.txt' + addWords: true +dictionaries: + - project-words +ignorePaths: + - 'vendor' + - 'bin' + - '/project-words.txt' diff --git a/pkg/yqlib/decoder_yaml.go b/pkg/yqlib/decoder_yaml.go index a87233bc..c2652744 100644 --- a/pkg/yqlib/decoder_yaml.go +++ b/pkg/yqlib/decoder_yaml.go @@ -49,7 +49,7 @@ func (dec *yamlDecoder) processReadStream(reader *bufio.Reader) (io.Reader, stri } } else if string(peekBytes) == "---" { _, err := reader.ReadString('\n') - sb.WriteString("$yqDocSeperator$\n") + sb.WriteString("$yqDocSeparator$\n") if errors.Is(err, io.EOF) { return reader, sb.String(), nil } else if err != nil { diff --git a/pkg/yqlib/doc/operators/group-by.md b/pkg/yqlib/doc/operators/group-by.md index f5169b72..c06b273e 100644 --- a/pkg/yqlib/doc/operators/group-by.md +++ b/pkg/yqlib/doc/operators/group-by.md @@ -26,7 +26,7 @@ will output bar: 100 ``` -## Group by field, with nuls +## Group by field, with nulls Given a sample.yml file of: ```yaml - cat: dog diff --git a/pkg/yqlib/doc/operators/headers/Main.md b/pkg/yqlib/doc/operators/headers/Main.md index 59284fdf..d6c4c1c7 100644 --- a/pkg/yqlib/doc/operators/headers/Main.md +++ b/pkg/yqlib/doc/operators/headers/Main.md @@ -26,7 +26,7 @@ yq '.a.b[0].c' file.yaml cat file.yaml | yq '.a.b[0].c' ``` -## Update a yaml file, inplace +## Update a yaml file, in place ```bash yq -i '.a.b[0].c = "cool"' file.yaml ``` diff --git a/pkg/yqlib/doc/usage/shellvariables.md b/pkg/yqlib/doc/usage/shellvariables.md index a2919715..ba50315a 100644 --- a/pkg/yqlib/doc/usage/shellvariables.md +++ b/pkg/yqlib/doc/usage/shellvariables.md @@ -34,7 +34,7 @@ Given a sample.yml file of: ascii_=_symbols: replaced with _ "ascii_ _controls": dropped (this example uses \t) nonascii_א_characters: dropped -effrot_expeñded_tò_preserve_accented_latin_letters: moderate (via unicode NFKD) +effort_expeñded_tò_preserve_accented_latin_letters: moderate (via unicode NFKD) ``` then @@ -46,7 +46,7 @@ will output ascii___symbols='replaced with _' ascii__controls='dropped (this example uses \t)' nonascii__characters=dropped -effrot_expended_to_preserve_accented_latin_letters='moderate (via unicode NFKD)' +effort_expended_to_preserve_accented_latin_letters='moderate (via unicode NFKD)' ``` ## Encode shell variables: empty values, arrays and maps diff --git a/pkg/yqlib/encoder_lua.go b/pkg/yqlib/encoder_lua.go index 898b3855..a74c68cb 100644 --- a/pkg/yqlib/encoder_lua.go +++ b/pkg/yqlib/encoder_lua.go @@ -100,7 +100,7 @@ func (le *luaEncoder) encodeString(writer io.Writer, node *yaml.Node) error { case yaml.SingleQuotedStyle: quote = "'" - // falltrough to regular ol' string + // fallthrough to regular ol' string } return writeString(writer, quote+le.escape.Replace(node.Value)+quote) } diff --git a/pkg/yqlib/encoder_properties.go b/pkg/yqlib/encoder_properties.go index d615fa52..575b4e89 100644 --- a/pkg/yqlib/encoder_properties.go +++ b/pkg/yqlib/encoder_properties.go @@ -37,7 +37,7 @@ func (pe *propertiesEncoder) PrintLeadingContent(writer io.Writer, content strin if errReading != nil && !errors.Is(errReading, io.EOF) { return errReading } - if strings.Contains(readline, "$yqDocSeperator$") { + if strings.Contains(readline, "$yqDocSeparator$") { if err := pe.PrintDocumentSeparator(writer); err != nil { return err diff --git a/pkg/yqlib/encoder_yaml.go b/pkg/yqlib/encoder_yaml.go index 315a4695..75b64c04 100644 --- a/pkg/yqlib/encoder_yaml.go +++ b/pkg/yqlib/encoder_yaml.go @@ -47,7 +47,7 @@ func (ye *yamlEncoder) PrintLeadingContent(writer io.Writer, content string) err if errReading != nil && !errors.Is(errReading, io.EOF) { return errReading } - if strings.Contains(readline, "$yqDocSeperator$") { + if strings.Contains(readline, "$yqDocSeparator$") { if err := ye.PrintDocumentSeparator(writer); err != nil { return err diff --git a/pkg/yqlib/lexer_participle.go b/pkg/yqlib/lexer_participle.go index 3a3b7c10..2352354a 100644 --- a/pkg/yqlib/lexer_participle.go +++ b/pkg/yqlib/lexer_participle.go @@ -26,8 +26,8 @@ var participleYqRules = []*participleYqRule{ {"RecursiveDecent", `\.\.`, recursiveDecentOpToken(false), 0}, {"GetVariable", `\$[a-zA-Z_\-0-9]+`, getVariableOpToken(), 0}, - {"AsignAsVariable", `as`, opTokenWithPrefs(assignVariableOpType, nil, assignVarPreferences{}), 0}, - {"AsignRefVariable", `ref`, opTokenWithPrefs(assignVariableOpType, nil, assignVarPreferences{IsReference: true}), 0}, + {"AssignAsVariable", `as`, opTokenWithPrefs(assignVariableOpType, nil, assignVarPreferences{}), 0}, + {"AssignRefVariable", `ref`, opTokenWithPrefs(assignVariableOpType, nil, assignVarPreferences{IsReference: true}), 0}, {"CreateMap", `:\s*`, opToken(createMapOpType), 0}, simpleOp("length", lengthOpType), diff --git a/pkg/yqlib/operator_comments.go b/pkg/yqlib/operator_comments.go index 5bbe2e59..ecf882af 100644 --- a/pkg/yqlib/operator_comments.go +++ b/pkg/yqlib/operator_comments.go @@ -77,8 +77,8 @@ func assignCommentsOperator(d *dataTreeNavigator, context Context, expressionNod func getCommentsOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) { preferences := expressionNode.Operation.Preferences.(commentOpPreferences) - var startCommentCharaterRegExp = regexp.MustCompile(`^# `) - var subsequentCommentCharaterRegExp = regexp.MustCompile(`\n# `) + var startCommentCharacterRegExp = regexp.MustCompile(`^# `) + var subsequentCommentCharacterRegExp = regexp.MustCompile(`\n# `) log.Debugf("GetComments operator!") var results = list.New() @@ -112,8 +112,8 @@ func getCommentsOperator(d *dataTreeNavigator, context Context, expressionNode * } else if preferences.FootComment { comment = candidate.Node.FootComment } - comment = startCommentCharaterRegExp.ReplaceAllString(comment, "") - comment = subsequentCommentCharaterRegExp.ReplaceAllString(comment, "\n") + comment = startCommentCharacterRegExp.ReplaceAllString(comment, "") + comment = subsequentCommentCharacterRegExp.ReplaceAllString(comment, "\n") node := &yaml.Node{Kind: yaml.ScalarNode, Value: comment, Tag: "!!str"} result := candidate.CreateReplacement(node) diff --git a/pkg/yqlib/operator_datetime.go b/pkg/yqlib/operator_datetime.go index 25bafa9e..03cdf95f 100644 --- a/pkg/yqlib/operator_datetime.go +++ b/pkg/yqlib/operator_datetime.go @@ -10,7 +10,7 @@ import ( "gopkg.in/yaml.v3" ) -func getStringParamter(parameterName string, d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (string, error) { +func getStringParameter(parameterName string, d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (string, error) { result, err := d.GetMatchingNodes(context.ReadOnlyClone(), expressionNode) if err != nil { @@ -24,7 +24,7 @@ func getStringParamter(parameterName string, d *dataTreeNavigator, context Conte func withDateTimeFormat(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) { if expressionNode.RHS.Operation.OperationType == blockOpType || expressionNode.RHS.Operation.OperationType == unionOpType { - layout, err := getStringParamter("layout", d, context, expressionNode.RHS.LHS) + layout, err := getStringParameter("layout", d, context, expressionNode.RHS.LHS) if err != nil { return Context{}, fmt.Errorf("could not get date time format: %w", err) } @@ -63,7 +63,7 @@ func parseDateTime(layout string, datestring string) (time.Time, error) { } func formatDateTime(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) { - format, err := getStringParamter("format", d, context, expressionNode.RHS) + format, err := getStringParameter("format", d, context, expressionNode.RHS) layout := context.GetDateTimeLayout() if err != nil { @@ -97,7 +97,7 @@ func formatDateTime(d *dataTreeNavigator, context Context, expressionNode *Expre } func tzOp(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) { - timezoneStr, err := getStringParamter("timezone", d, context, expressionNode.RHS) + timezoneStr, err := getStringParameter("timezone", d, context, expressionNode.RHS) layout := context.GetDateTimeLayout() if err != nil { diff --git a/pkg/yqlib/operator_group_by_test.go b/pkg/yqlib/operator_group_by_test.go index 2c7803da..7332bd32 100644 --- a/pkg/yqlib/operator_group_by_test.go +++ b/pkg/yqlib/operator_group_by_test.go @@ -14,7 +14,7 @@ var groupByOperatorScenarios = []expressionScenario{ }, }, { - description: "Group by field, with nuls", + description: "Group by field, with nulls", document: `[{cat: dog}, {foo: 1, bar: 10}, {foo: 3, bar: 100}, {no: foo for you}, {foo: 1, bar: 1}]`, expression: `group_by(.foo)`, expected: []string{ diff --git a/pkg/yqlib/operator_keys.go b/pkg/yqlib/operator_keys.go index 0e77310f..3ea4b5da 100644 --- a/pkg/yqlib/operator_keys.go +++ b/pkg/yqlib/operator_keys.go @@ -50,7 +50,7 @@ func keysOperator(d *dataTreeNavigator, context Context, expressionNode *Express if node.Kind == yaml.MappingNode { targetNode = getMapKeys(node) } else if node.Kind == yaml.SequenceNode { - targetNode = getIndicies(node) + targetNode = getIndices(node) } else { return Context{}, fmt.Errorf("Cannot get keys of %v, keys only works for maps and arrays", node.Tag) } @@ -70,7 +70,7 @@ func getMapKeys(node *yaml.Node) *yaml.Node { return &yaml.Node{Kind: yaml.SequenceNode, Tag: "!!seq", Content: contents} } -func getIndicies(node *yaml.Node) *yaml.Node { +func getIndices(node *yaml.Node) *yaml.Node { var contents = make([]*yaml.Node, len(node.Content)) for index := range node.Content { diff --git a/pkg/yqlib/operator_pick.go b/pkg/yqlib/operator_pick.go index 416d947d..5a6f7d2c 100644 --- a/pkg/yqlib/operator_pick.go +++ b/pkg/yqlib/operator_pick.go @@ -76,7 +76,7 @@ func pickOperator(d *dataTreeNavigator, context Context, expressionNode *Express } } else { - return Context{}, fmt.Errorf("cannot pick indicies from type %v (%v)", node.Tag, candidate.GetNicePath()) + return Context{}, fmt.Errorf("cannot pick indices from type %v (%v)", node.Tag, candidate.GetNicePath()) } results.PushBack(candidate.CreateReplacementWithDocWrappers(replacement)) diff --git a/pkg/yqlib/operator_traverse_path.go b/pkg/yqlib/operator_traverse_path.go index 4308545a..5af781db 100644 --- a/pkg/yqlib/operator_traverse_path.go +++ b/pkg/yqlib/operator_traverse_path.go @@ -202,7 +202,7 @@ func traverseArrayWithIndices(candidate *CandidateNode, indices []*yaml.Node, pr contentLength := len(node.Content) for contentLength <= index { if contentLength == 0 { - // default to nice yaml formating + // default to nice yaml formatting node.Style = 0 } diff --git a/pkg/yqlib/printer.go b/pkg/yqlib/printer.go index c430fcfe..8388b0d9 100644 --- a/pkg/yqlib/printer.go +++ b/pkg/yqlib/printer.go @@ -148,7 +148,7 @@ func (p *resultsPrinter) PrintResults(matchingNodes *list.List) error { return errorWriting } - commentsStartWithSepExp := regexp.MustCompile(`^\$yqDocSeperator\$`) + commentsStartWithSepExp := regexp.MustCompile(`^\$yqDocSeparator\$`) commentStartsWithSeparator := commentsStartWithSepExp.MatchString(mappedDoc.LeadingContent) if (p.previousDocIndex != mappedDoc.Document || p.previousFileIndex != mappedDoc.FileIndex) && !commentStartsWithSeparator { diff --git a/pkg/yqlib/printer_test.go b/pkg/yqlib/printer_test.go index 4b32f371..fd6068f7 100644 --- a/pkg/yqlib/printer_test.go +++ b/pkg/yqlib/printer_test.go @@ -82,15 +82,15 @@ func TestPrinterMultipleDocsInSequenceWithLeadingContent(t *testing.T) { } el := inputs.Front() - el.Value.(*CandidateNode).LeadingContent = "# go cats\n$yqDocSeperator$\n" + el.Value.(*CandidateNode).LeadingContent = "# go cats\n$yqDocSeparator$\n" sample1 := nodeToList(el.Value.(*CandidateNode)) el = el.Next() - el.Value.(*CandidateNode).LeadingContent = "$yqDocSeperator$\n" + el.Value.(*CandidateNode).LeadingContent = "$yqDocSeparator$\n" sample2 := nodeToList(el.Value.(*CandidateNode)) el = el.Next() - el.Value.(*CandidateNode).LeadingContent = "$yqDocSeperator$\n# cool\n" + el.Value.(*CandidateNode).LeadingContent = "$yqDocSeparator$\n# cool\n" sample3 := nodeToList(el.Value.(*CandidateNode)) err = printer.PrintResults(sample1) @@ -174,21 +174,21 @@ func TestPrinterMultipleFilesInSequenceWithLeadingContent(t *testing.T) { elNode := el.Value.(*CandidateNode) elNode.Document = 0 elNode.FileIndex = 0 - elNode.LeadingContent = "# go cats\n$yqDocSeperator$\n" + elNode.LeadingContent = "# go cats\n$yqDocSeparator$\n" sample1 := nodeToList(elNode) el = el.Next() elNode = el.Value.(*CandidateNode) elNode.Document = 0 elNode.FileIndex = 1 - elNode.LeadingContent = "$yqDocSeperator$\n" + elNode.LeadingContent = "$yqDocSeparator$\n" sample2 := nodeToList(elNode) el = el.Next() elNode = el.Value.(*CandidateNode) elNode.Document = 0 elNode.FileIndex = 2 - elNode.LeadingContent = "$yqDocSeperator$\n# cool\n" + elNode.LeadingContent = "$yqDocSeparator$\n# cool\n" sample3 := nodeToList(elNode) err = printer.PrintResults(sample1) @@ -239,7 +239,7 @@ func TestPrinterMultipleDocsInSinglePrintWithLeadingDoc(t *testing.T) { panic(err) } - inputs.Front().Value.(*CandidateNode).LeadingContent = "# go cats\n$yqDocSeperator$\n" + inputs.Front().Value.(*CandidateNode).LeadingContent = "# go cats\n$yqDocSeparator$\n" err = printer.PrintResults(inputs) if err != nil { @@ -267,7 +267,7 @@ func TestPrinterMultipleDocsInSinglePrintWithLeadingDocTrailing(t *testing.T) { if err != nil { panic(err) } - inputs.Front().Value.(*CandidateNode).LeadingContent = "$yqDocSeperator$\n" + inputs.Front().Value.(*CandidateNode).LeadingContent = "$yqDocSeparator$\n" err = printer.PrintResults(inputs) if err != nil { panic(err) @@ -313,7 +313,7 @@ func TestPrinterMultipleDocsJson(t *testing.T) { var output bytes.Buffer var writer = bufio.NewWriter(&output) // note printDocSeparators is true, it should still not print document separators - // when outputing JSON. + // when outputting JSON. encoder := NewJSONEncoder(0, false, false) if encoder == nil { t.Skipf("no support for %s output format", "json") @@ -365,7 +365,7 @@ func TestPrinterNulSeparatorWithJson(t *testing.T) { var output bytes.Buffer var writer = bufio.NewWriter(&output) // note printDocSeparators is true, it should still not print document separators - // when outputing JSON. + // when outputting JSON. encoder := NewJSONEncoder(0, false, false) if encoder == nil { t.Skipf("no support for %s output format", "json") diff --git a/pkg/yqlib/shellvariables_test.go b/pkg/yqlib/shellvariables_test.go index a922734e..5a7f56f4 100644 --- a/pkg/yqlib/shellvariables_test.go +++ b/pkg/yqlib/shellvariables_test.go @@ -35,12 +35,12 @@ var shellVariablesScenarios = []formatScenario{ "ascii_=_symbols: replaced with _" + "\n" + "\"ascii_\t_controls\": dropped (this example uses \\t)" + "\n" + "nonascii_\u05d0_characters: dropped" + "\n" + - "effrot_expe\u00f1ded_t\u00f2_preserve_accented_latin_letters: moderate (via unicode NFKD)" + "\n", + "effort_expe\u00f1ded_t\u00f2_preserve_accented_latin_letters: moderate (via unicode NFKD)" + "\n", expected: "" + "ascii___symbols='replaced with _'" + "\n" + "ascii__controls='dropped (this example uses \\t)'" + "\n" + "nonascii__characters=dropped" + "\n" + - "effrot_expended_to_preserve_accented_latin_letters='moderate (via unicode NFKD)'" + "\n", + "effort_expended_to_preserve_accented_latin_letters='moderate (via unicode NFKD)'" + "\n", }, { description: "Encode shell variables: empty values, arrays and maps", @@ -65,10 +65,10 @@ func TestShellVariableScenarios(t *testing.T) { for i, s := range shellVariablesScenarios { genericScenarios[i] = s } - documentScenarios(t, "usage", "shellvariables", genericScenarios, documentShellVaraibleScenario) + documentScenarios(t, "usage", "shellvariables", genericScenarios, documentShellVariableScenario) } -func documentShellVaraibleScenario(_ *testing.T, w *bufio.Writer, i interface{}) { +func documentShellVariableScenario(_ *testing.T, w *bufio.Writer, i interface{}) { s := i.(formatScenario) if s.skipDoc { return diff --git a/pkg/yqlib/write_in_place_handler.go b/pkg/yqlib/write_in_place_handler.go index d49b2963..83d42134 100644 --- a/pkg/yqlib/write_in_place_handler.go +++ b/pkg/yqlib/write_in_place_handler.go @@ -44,7 +44,7 @@ func (w *writeInPlaceHandlerImpl) CreateTempFile() (*os.File, error) { } func (w *writeInPlaceHandlerImpl) FinishWriteInPlace(evaluatedSuccessfully bool) error { - log.Debug("Going to write-inplace, evaluatedSuccessfully=%v, target=%v", evaluatedSuccessfully, w.inputFilename) + log.Debug("Going to write in place, evaluatedSuccessfully=%v, target=%v", evaluatedSuccessfully, w.inputFilename) safelyCloseFile(w.tempFile) if evaluatedSuccessfully { log.Debug("Moving temp file to target") diff --git a/pkg/yqlib/xml_test.go b/pkg/yqlib/xml_test.go index e90e3654..fdf50b98 100644 --- a/pkg/yqlib/xml_test.go +++ b/pkg/yqlib/xml_test.go @@ -671,7 +671,7 @@ func documentXMLScenario(t *testing.T, w *bufio.Writer, i interface{}) { case "decode-raw-token-off": documentXMLDecodeKeepNsRawTokenScenario(w, s) case "roundtrip-skip-directives": - documentXMLSkipDirectrivesScenario(w, s) + documentXMLSkipDirectivesScenario(w, s) default: panic(fmt.Sprintf("unhandled scenario type %q", s.scenarioType)) @@ -787,7 +787,7 @@ func documentXMLRoundTripScenario(w *bufio.Writer, s formatScenario) { writeOrPanic(w, fmt.Sprintf("```xml\n%v```\n\n", mustProcessFormatScenario(s, NewXMLDecoder(ConfiguredXMLPreferences), NewXMLEncoder(2, ConfiguredXMLPreferences)))) } -func documentXMLSkipDirectrivesScenario(w *bufio.Writer, s formatScenario) { +func documentXMLSkipDirectivesScenario(w *bufio.Writer, s formatScenario) { writeOrPanic(w, fmt.Sprintf("## %v\n", s.description)) if s.subdescription != "" { diff --git a/project-words.txt b/project-words.txt new file mode 100644 index 00000000..218a49b7 --- /dev/null +++ b/project-words.txt @@ -0,0 +1,253 @@ +abxbbxdbxebxczzx +abxbbxdbxebxczzy +accum +Accum +adithyasunil +AEDT +água +ÁGUA +alecthomas +appleapple +Astuff +autocreating +autoparse +AWST +axbxcxdxe +axbxcxdxexxx +bananabanana +barp +bitnami +blarp +blddir +Bobo +BODMAS +bonapite +Brien +Bstuff +BUILDKIT +buildpackage +catmeow +CATYPE +CBVVE +chardata +chillum +choco +chomper +cleanup +cmlu +colorise +colors +compinit +coolioo +coverprofile +createmap +csvd +CSVUTF +currentlabel +cygpath +czvf +datestring +datetime +Datetime +datetimes +DEBEMAIL +debhelper +Debugf +debuild +delish +delpaths +DELPATHS +devorbitus +devscripts +dimchansky +Dont +dput +elliotchance +endhint +endofname +Entriesfrom +envsubst +errorlevel +Escandón +Evalall +fakefilename +fakeroot +Farah +fatih +Fifi +filebytes +Fileish +foobar +foobaz +foof +frood +fullpath +gitbook +githubactions +gnupg +goccy +gofmt +gogo +golangci +GOMODCACHE +GOPATH +gosec +gota +goversion +GOVERSION +haha +headcommentwas +hellno +herbygillot +hexdump +Hoang +hostpath +hotdog +howdy +incase +inlinetables +inplace +ints +ireduce +iwatch +jinzhu +jq's +jsond +keygrip +Keygrip +KEYGRIP +KEYID +keyvalue +kwak +lalilu +ldflags +LDFLAGS +lexer +Lexer +libdistro +lindex +linecomment +magiconair +mapvalues +Mier +mikefarah +minideb +minishift +mipsle +mitchellh +mktemp +multidoc +multimaint +multine +myenv +myenvnonexisting +myfile +myformat +ndjson +NDJSON +NFKD +nixpkgs +nojson +nonascii +nonempty +noninteractive +Nonquoting +nosec +notoml +noxml +nullinput +onea +Oneshot +opencollect +opstack +orderedmap +orignal +osarch +overridign +pacman +Padder +pandoc +parsechangelog +pcsv +pelletier +pflag +prechecking +Prerelease +proc +propsd +qylib +readline +realnames +realpath +repr +rhash +rindex +risentveber +rmescandon +Rosey +roundtrip +Roundtrip +roundtripping +runningvms +sadface +selfupdate +setpath +sharedfolder +Sharedfolder +shellvariables +shellvars +shortfunc +shortpipe +shunit +Sidenote +snapcraft +somevalue +splt +squeek +srcdir +stackoverflow +stiched +Strc +strenv +strload +stylig +subarray +subchild +subdescription +submatch +submatches +SUBSTR +tempfile +tfstate +Tfstate +thar +timezone +Timezone +timezones +Timezones +tojson +Tokenvalue +traver +tsvd +Tuan +tzdata +Uhoh +updateassign +urid +utfbom +Warningf +Wazowski +webi +Webi +whereever +winget +withdots +wizz +woop +workdir +Writable +xmld +xyzzy +yamld +yqlib +zabbix diff --git a/scripts/extract-checksum.sh b/scripts/extract-checksum.sh index 914dcfa2..3ba11104 100755 --- a/scripts/extract-checksum.sh +++ b/scripts/extract-checksum.sh @@ -26,7 +26,7 @@ if [ "$1" == "" ]; then fi if [ "$2" != "" ]; then - # so we dont match x.tar.gz when 'x' is given + # so we don't match x.tar.gz when 'x' is given file="$2\s" else file="" @@ -47,7 +47,7 @@ fi grepMatch=$(grep -m 1 -n "$1" checksums_hashes_order) if [ "$grepMatch" == "" ]; then - echo "Could not find hash algorith '$1' in checksums_hashes_order" + echo "Could not find hash algorithm '$1' in checksums_hashes_order" exit 1 fi diff --git a/scripts/generate-man-page-md.sh b/scripts/generate-man-page-md.sh index 34283fc1..b2e0494c 100755 --- a/scripts/generate-man-page-md.sh +++ b/scripts/generate-man-page-md.sh @@ -1,7 +1,7 @@ #! /bin/bash set -e -# note that this reqires pandoc to be installed. +# note that this requires pandoc to be installed. cat ./pkg/yqlib/doc/operators/headers/Main.md > man.md printf "\n# HOW IT WORKS\n" >> man.md diff --git a/scripts/generate-man-page.sh b/scripts/generate-man-page.sh index b39e21bf..2d658004 100755 --- a/scripts/generate-man-page.sh +++ b/scripts/generate-man-page.sh @@ -1,7 +1,7 @@ #! /bin/bash set -e -# note that this reqires pandoc to be installed. +# note that this requires pandoc to be installed. pandoc \ --variable=title:"YQ" \ diff --git a/scripts/release-deb.sh b/scripts/release-deb.sh index c3cf5353..fc2d9a16 100755 --- a/scripts/release-deb.sh +++ b/scripts/release-deb.sh @@ -30,7 +30,7 @@ show_help() { echo " distribution is considered" echo " --goversion VERSION The version of Golang to use. Default to $GOVERSION" echo " -k, --sign-key KEYID Sign the package sources with the provided gpg key id (long format). When not provided this" - echo " paramater, the generated sources are not signed" + echo " parameter, the generated sources are not signed" echo " -s, --sign Sign the package sources with a gpg key of the maintainer" echo " -m, --maintainer WHO The maintainer used as author of the changelog. git.name and git.email (see git config) is" echo " the considered format" diff --git a/scripts/spelling.sh b/scripts/spelling.sh new file mode 100755 index 00000000..00c39f74 --- /dev/null +++ b/scripts/spelling.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +npx cspell --no-progress "**/*.{sh,go}" \ No newline at end of file