From aa1f5833cbd87180943cdbcf7144736aa9697455 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 13:45:19 -0500 Subject: [PATCH 1/5] Add github action to codespell master on push and PRs --- .github/workflows/codespell.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 000000000..eeaceadfc --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,23 @@ +# Codespell configuration is within .codespellrc +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Codespell + uses: codespell-project/actions-codespell@v2 From c247a9f0d8abae827f10bfc75197a81c0a6e6da5 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 13:45:19 -0500 Subject: [PATCH 2/5] Add rudimentary codespell config --- .codespellrc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..871ada5f2 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,6 @@ +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = .git,go.sum,.codespellrc +check-hidden = true +# ignore-regex = +# ignore-words-list = From 058e25dbaebcf8550ab0f1299ac7d3be1c260096 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 13:47:22 -0500 Subject: [PATCH 3/5] Custom skips for codespell of s5cmd --- .codespellrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.codespellrc b/.codespellrc index 871ada5f2..5f04ef8c8 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,6 +1,6 @@ [codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = .git,go.sum,.codespellrc +skip = .git,go.sum,.codespellrc,vendor check-hidden = true -# ignore-regex = -# ignore-words-list = +ignore-regex = \bfiletest\.txt\b +ignore-words-list = hypen,bu,te From a0d37c9cfb93ed3fd2075c9751e883e5cedfda3a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 13:47:45 -0500 Subject: [PATCH 4/5] [DATALAD RUNCMD] Do interactive fixing of typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2 ./command/ls.go", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- command/ls.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/ls.go b/command/ls.go index 87ff1e06b..b65d0c89e 100644 --- a/command/ls.go +++ b/command/ls.go @@ -254,7 +254,7 @@ func (l ListMessage) String() string { return l.Object.URL.String() } var etag string - // date and storage fiels + // date and storage fields var listFormat = "%19s %2s" // align etag From 0b622eeab9362b79db2452c118b3031ab9793a1b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 13:47:48 -0500 Subject: [PATCH 5/5] [DATALAD RUNCMD] run codespell throughout fixing typo automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- CHANGELOG.md | 2 +- command/auto_complete.go | 2 +- command/error.go | 2 +- e2e/auto_complete_test.go | 2 +- e2e/cp_test.go | 4 ++-- error/error.go | 2 +- storage/s3.go | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56043dab0..06fe5f94a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,7 +107,7 @@ - Added `select` command. It allows to select JSON records from objects using SQL expressions. ([#299](https://github.com/peak/s5cmd/issues/299)) [@skeggse](https://github.com/skeggse) - Added `rb` command to remove buckets. ([#303](https://github.com/peak/s5cmd/issues/303)) - Added `--exclude` flag to `cp`, `rm`, `ls`, `du` and `select` commands. This flag allows users to exclude objects with given pattern. ([#266](https://github.com/peak/s5cmd/issues/266)) -- Added `--raw` flag to `cp` and `rm` commands. It disables the wildcard operations. It is useful when an object contains glob characters which interfers with glob expansion logic. ([#235](https://github.com/peak/s5cmd/issues/235)) +- Added `--raw` flag to `cp` and `rm` commands. It disables the wildcard operations. It is useful when an object contains glob characters which interferes with glob expansion logic. ([#235](https://github.com/peak/s5cmd/issues/235)) - Added `--cache-control` and `--expires` flags to `cp` and `mv` commands. It adds support for setting cache control and expires header to S3 objects. ([#318](https://github.com/peak/s5cmd/pull/318)) [@tombokombo](https://github.com/tombokombo) - Added `--force-glacier-transfer` flag to `cp` command. It forces a transfer request on all Glacier objects. ([#206](https://github.com/peak/s5cmd/issues/206)) - Added `--source-region` and `destination-region` flags to `cp` command. It allows overriding bucket region. ([#262](https://github.com/peak/s5cmd/issues/262)) [@kemege](https://github.com/kemege) diff --git a/command/auto_complete.go b/command/auto_complete.go index fe01f9495..ce48543a8 100644 --- a/command/auto_complete.go +++ b/command/auto_complete.go @@ -210,7 +210,7 @@ func formatSuggestionForShell(baseShell, suggestion, argToBeCompleted string) st return strings.Join(suggestions, "\n") case "zsh": // replace every colon : with \: if shell is zsh - // colons are used as a seperator for the autocompletion script + // colons are used as a separator for the autocompletion script // so "literal colons in completion must be quoted with a backslash" // see also https://zsh.sourceforge.io/Doc/Release/Completion-System.html#:~:text=This%20is%20followed,as%20name1%3B return strings.ReplaceAll(suggestion, ":", `\:`) diff --git a/command/error.go b/command/error.go index 37294ce4f..91e728813 100644 --- a/command/error.go +++ b/command/error.go @@ -29,7 +29,7 @@ func printDebug(op string, err error, urls ...*url.URL) { // printError is the helper function to log error messages. func printError(command, op string, err error) { - // dont print cancelation errors + // dont print cancellation errors if errorpkg.IsCancelation(err) { return } diff --git a/e2e/auto_complete_test.go b/e2e/auto_complete_test.go index a0da0cee6..4787e2bc9 100644 --- a/e2e/auto_complete_test.go +++ b/e2e/auto_complete_test.go @@ -228,7 +228,7 @@ func TestCompletionFlag(t *testing.T) { shell: "/bin/pwsh", }, /* - Question marks and asterisk are thought to be wildcard (special charactes) + Question marks and asterisk are thought to be wildcard (special characters) by the s5cmd so when they're given s5cmd's behaviour changes. When asterisk is given s5cmd also matches the keys with literal '*' as well as diff --git a/e2e/cp_test.go b/e2e/cp_test.go index 48867bd68..0e756a118 100644 --- a/e2e/cp_test.go +++ b/e2e/cp_test.go @@ -260,7 +260,7 @@ func TestCopyS3PrefixToLocalMustReturnError(t *testing.T) { assert.Assert(t, ensureS3Object(s3client, bucket, objectpath, content)) } -// cp --flatten s3://bucket/* dir/ (flat source hiearchy) +// cp --flatten s3://bucket/* dir/ (flat source hierarchy) func TestCopyMultipleFlatS3ObjectsToLocal(t *testing.T) { t.Parallel() @@ -4308,7 +4308,7 @@ func TestDeleteFileWhenDownloadFailed(t *testing.T) { assert.Assert(t, fs.Equal(cmd.Dir, expected)) } -// Target local file should be overriden only if download completed successfully +// Target local file should be overridden only if download completed successfully func TestLocalFileOverridenWhenDownloadFailed(t *testing.T) { t.Parallel() diff --git a/error/error.go b/error/error.go index e6dddfd98..3efba3878 100644 --- a/error/error.go +++ b/error/error.go @@ -39,7 +39,7 @@ func (e *Error) Unwrap() error { return e.Err } -// IsCancelation reports whether if given error is a cancelation error. +// IsCancelation reports whether if given error is a cancellation error. func IsCancelation(err error) bool { if err == nil { return false diff --git a/storage/s3.go b/storage/s3.go index f6ebcffd3..673fff8d9 100644 --- a/storage/s3.go +++ b/storage/s3.go @@ -895,7 +895,7 @@ func (s *S3) retryOnNoSuchUpload(ctx aws.Context, to *url.URL, input *s3manager. attempts := 0 for ; errHasCode(err, s3.ErrCodeNoSuchUpload) && attempts < s.noSuchUploadRetryCount; attempts++ { // check if object exists and has the retry ID we provided, if it does - // then it means that one of previous uploads was succesfull despite the received error. + // then it means that one of previous uploads was successful despite the received error. obj, sErr := s.Stat(ctx, to) if sErr == nil && obj.retryID == expectedRetryID { err = nil @@ -1400,7 +1400,7 @@ func errHasCode(err error, code string) bool { } // IsCancelationError reports whether given error is a storage related -// cancelation error. +// cancellation error. func IsCancelationError(err error) bool { return errHasCode(err, request.CanceledErrorCode) }