Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codespell support (config, github action to detect, not fix) typos; make it fix some found #701

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .codespellrc
@@ -0,0 +1,6 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git,go.sum,.codespellrc,vendor
check-hidden = true
ignore-regex = \bfiletest\.txt\b
ignore-words-list = hypen,bu,te
23 changes: 23 additions & 0 deletions .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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion command/auto_complete.go
Expand Up @@ -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, ":", `\:`)
Expand Down
2 changes: 1 addition & 1 deletion command/error.go
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion command/ls.go
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion e2e/auto_complete_test.go
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions e2e/cp_test.go
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion error/error.go
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions storage/s3.go
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down