From 86d8539ce405999139847bbea5d80f51572aa7b0 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Tue, 16 Jul 2024 10:13:45 -0700 Subject: [PATCH 1/2] ci: Configure crate-ci/typos and auto fix what I can --- _typos.toml | 16 ++++++++++++++++ args.go | 4 ++-- commands/command_config.go | 2 +- commands/databases.go | 4 ++-- commands/functions.go | 3 ++- commands/serverless_test.go | 2 +- do/serverless.go | 2 +- integration/droplet_neighbors_test.go | 2 +- scripts/version.sh | 2 +- 9 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 _typos.toml diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 000000000..50126075a --- /dev/null +++ b/_typos.toml @@ -0,0 +1,16 @@ +[files] +extend-exclude = [ + "vendor/**", + "go.mod" +] + +[default.extend-identifiers] +vas = "vas" +splitted = "splitted" + +[default.extend-words] +# Its not perfect at hashes yet +cace = "cace" +Wqs = "Wqs" +# example and exmaple as two domain examples +exmaple = "exmaple" diff --git a/args.go b/args.go index fda546cc8..ff56b1cea 100644 --- a/args.go +++ b/args.go @@ -429,8 +429,8 @@ const ( ArgDatabaseTopicMaxCompactionLagMS = "max-compaction-lag-ms" // ArgDatabaseTopicMaxMessageBytes is the maximum size, in bytes, of the largest record batch that can be sent to the server ArgDatabaseTopicMaxMessageBytes = "max-message-bytes" - // ArgDatabaseTopicMesssageDownConversionEnable determines whether brokers should convert messages for consumers expecting older message formats - ArgDatabaseTopicMesssageDownConversionEnable = "message-down-conversion-enable" + // ArgDatabaseTopicMessageDownConversionEnable determines whether brokers should convert messages for consumers expecting older message formats + ArgDatabaseTopicMessageDownConversionEnable = "message-down-conversion-enable" // ArgDatabaseTopicMessageFormatVersion is the version used by the broker to append messages to the kafka topic logs ArgDatabaseTopicMessageFormatVersion = "message-format-version" // ArgDatabaseTopicMessageTimestampType is the timestamp used for messages diff --git a/commands/command_config.go b/commands/command_config.go index a89d87f50..943e7df0d 100644 --- a/commands/command_config.go +++ b/commands/command_config.go @@ -226,7 +226,7 @@ func (c *CmdConfig) Display(d displayers.Displayable) error { return dc.Display() } -// An urner implements the URN method, wihich returns a valid uniform resource +// An urner implements the URN method, which returns a valid uniform resource // name. type urner interface { URN() string diff --git a/commands/databases.go b/commands/databases.go index 808c69008..17ac6d5e5 100644 --- a/commands/databases.go +++ b/commands/databases.go @@ -1791,7 +1791,7 @@ func getDatabaseTopicConfigArgs(c *CmdConfig) *godo.TopicConfig { res.MaxMessageBytes = &i } } - bVal, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgDatabaseTopicMesssageDownConversionEnable) + bVal, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgDatabaseTopicMessageDownConversionEnable) if err == nil && bVal != nil { res.MessageDownConversionEnable = bVal } @@ -1936,7 +1936,7 @@ This command lists the following details for each partition of a given topic in "Specifies the maximum time (in ms) that a message will remain uncompacted. This is only applicable if the logs have compaction enabled") AddStringFlag(c, doctl.ArgDatabaseTopicMaxMessageBytes, "", "", "Specifies the largest record batch (in bytes) that can be sent to the server. This is calculated after compression, if compression is enabled") - AddBoolFlag(c, doctl.ArgDatabaseTopicMesssageDownConversionEnable, "", true, + AddBoolFlag(c, doctl.ArgDatabaseTopicMessageDownConversionEnable, "", true, "Specifies whether down-conversion of message formats is enabled to satisfy consumer requests") AddStringFlag(c, doctl.ArgDatabaseTopicMessageFormatVersion, "", "", "Specifies the message format version used by the broker to append messages to the logs. By setting a format version, all existing messages on disk must be smaller or equal to the specified version") diff --git a/commands/functions.go b/commands/functions.go index e70ee0fb4..9d0d88075 100644 --- a/commands/functions.go +++ b/commands/functions.go @@ -23,11 +23,12 @@ import ( "strings" "github.com/apache/openwhisk-client-go/whisk" + "github.com/spf13/cobra" + "github.com/digitalocean/doctl" "github.com/digitalocean/doctl/commands/charm/template" "github.com/digitalocean/doctl/commands/displayers" "github.com/digitalocean/doctl/do" - "github.com/spf13/cobra" ) // Functions generates the serverless 'functions' subtree for addition to the doctl command diff --git a/commands/serverless_test.go b/commands/serverless_test.go index c96433828..5d6a3aba0 100644 --- a/commands/serverless_test.go +++ b/commands/serverless_test.go @@ -408,7 +408,7 @@ func TestServerlessInit(t *testing.T) { } sawOverwrite := false - // Grab the overrideable commands so they can be mocked + // Grab the overridable commands so they can be mocked writeAFile = func(path string, contents []byte) error { return nil } diff --git a/do/serverless.go b/do/serverless.go index 594fd2728..f611ce3b8 100644 --- a/do/serverless.go +++ b/do/serverless.go @@ -64,7 +64,7 @@ type OutputNamespace struct { } // FunctionParameter is the type of a parameter in the response body of action.get. We do our -// own JSON unmarshaling of these because the go OpenWhisk client doesn't include the "init" and +// own JSON unmarshalling of these because the go OpenWhisk client doesn't include the "init" and // "encryption" members, of which at least "init" is needed. type FunctionParameter struct { Key string `json:"key"` diff --git a/integration/droplet_neighbors_test.go b/integration/droplet_neighbors_test.go index 43e5d2c3e..543a90223 100644 --- a/integration/droplet_neighbors_test.go +++ b/integration/droplet_neighbors_test.go @@ -84,7 +84,7 @@ var _ = suite("compute/droplet/neighbors", func(t *testing.T, when spec.G, it sp }) when("asking for particular headers", func() { - it("only lists thoses headers", func() { + it("only lists those headers", func() { cmd := exec.Command(builtBinaryPath, "compute", "droplet", diff --git a/scripts/version.sh b/scripts/version.sh index 3e7ed832f..ff9e0dc49 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -18,7 +18,7 @@ Options: -i, --image snap image version -b, --branch branch only -c, --commit commit only - --snap, returns the version formated for a snap release + --snap, returns the version formatted for a snap release " semver() { From 6dcf649c45f71493dc910aa3fa2b685a23c6fcd8 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Tue, 16 Jul 2024 16:24:47 -0700 Subject: [PATCH 2/2] Add typos/spellcheck to contributing docs --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4bcb787ff..b384ee328 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,6 +101,11 @@ or `make help` for a list of available commands with descriptions. - Avoid the passive voice ("When a tag is provided, access is granted") and use the active voice ("Entering a tag provides access") - Be helpful when users have to enter a input that is from a list of possible values. Give examples, list the possible values inline (if the list is relatively short), or point them to a command that can list the possible values for them. +## Spell Check + +`doctl` is setup to use the code aware spell checker called [typos](https://github.com/crate-ci/typos) to keep an eye on any spelling mistakes. + +To install your own copy,follow the instructions on the [typos readme](https://github.com/crate-ci/typos?tab=readme-ov-file#install), and then run the `typos` binary ### Go environment