diff --git a/.cspell.json b/.cspell.json index 7e65ae9d0..107c9e082 100644 --- a/.cspell.json +++ b/.cspell.json @@ -79,7 +79,18 @@ "HEALTHCHECK", "devx", "gomod", - "laszlocph" + "laszlocph", + "charmbracelet", + "GODEBUG", + "netdns", + "BUILDPLATFORM", + "repology", + "WORKDIR", + "corepack", + "binutils", + "nocolor", + "logfile", + "Keyfunc" ], "ignorePaths": [ "**/node_modules/**/*", @@ -103,10 +114,8 @@ "agent/", "cli/", "cmd/", - "docker/", "docs/", "pipeline/", - "shared/", "server/" ], "enableFiletypes": ["dockercompose"] diff --git a/pipeline/backend/docker/docker.go b/pipeline/backend/docker/docker.go index 8a92deea5..2c7a0e835 100644 --- a/pipeline/backend/docker/docker.go +++ b/pipeline/backend/docker/docker.go @@ -213,7 +213,7 @@ func (e *docker) StartStep(ctx context.Context, step *backend.Step, taskUUID str } // add default volumes to the host configuration - hostConfig.Binds = utils.DedupStrings(append(hostConfig.Binds, e.volumes...)) + hostConfig.Binds = utils.DeduplicateStrings(append(hostConfig.Binds, e.volumes...)) _, err := e.client.ContainerCreate(ctx, config, hostConfig, nil, nil, containerName) if client.IsErrNotFound(err) { diff --git a/server/forge/gitea/helper.go b/server/forge/gitea/helper.go index 3cdaca8eb..0236ceb3b 100644 --- a/server/forge/gitea/helper.go +++ b/server/forge/gitea/helper.go @@ -118,7 +118,7 @@ func getChangedFilesFromPushHook(hook *pushHook) []string { files = append(files, hook.HeadCommit.Removed...) files = append(files, hook.HeadCommit.Modified...) - return utils.DedupStrings(files) + return utils.DeduplicateStrings(files) } // helper function that extracts the Pipeline data from a Gitea tag hook diff --git a/server/forge/github/github.go b/server/forge/github/github.go index 74734b1cc..3e0ae25dc 100644 --- a/server/forge/github/github.go +++ b/server/forge/github/github.go @@ -630,7 +630,7 @@ func (c *client) loadChangedFilesFromPullRequest(ctx context.Context, pull *gith opts.Page = resp.NextPage } - return utils.DedupStrings(fileList), nil + return utils.DeduplicateStrings(fileList), nil }) return pipeline, err diff --git a/server/forge/github/parse.go b/server/forge/github/parse.go index d6a5fb669..2a14a5a91 100644 --- a/server/forge/github/parse.go +++ b/server/forge/github/parse.go @@ -215,5 +215,5 @@ func getChangedFilesFromCommits(commits []*github.HeadCommit) []string { files = append(files, cm.Removed...) files = append(files, cm.Modified...) } - return utils.DedupStrings(files) + return utils.DeduplicateStrings(files) } diff --git a/server/forge/gitlab/convert.go b/server/forge/gitlab/convert.go index 9e9adc7cd..9c3077cfa 100644 --- a/server/forge/gitlab/convert.go +++ b/server/forge/gitlab/convert.go @@ -189,7 +189,7 @@ func convertPushHook(hook *gitlab.PushEvent) (*model.Repo, *model.Pipeline, erro files = append(files, cm.Removed...) files = append(files, cm.Modified...) } - pipeline.ChangedFiles = utils.DedupStrings(files) + pipeline.ChangedFiles = utils.DeduplicateStrings(files) return repo, pipeline, nil } diff --git a/server/forge/gitlab/gitlab.go b/server/forge/gitlab/gitlab.go index 79c51462b..4f05659a5 100644 --- a/server/forge/gitlab/gitlab.go +++ b/server/forge/gitlab/gitlab.go @@ -808,7 +808,7 @@ func (g *GitLab) loadChangedFilesFromMergeRequest(ctx context.Context, tmpRepo * for _, file := range changes { files = append(files, file.NewPath, file.OldPath) } - pipeline.ChangedFiles = utils.DedupStrings(files) + pipeline.ChangedFiles = utils.DeduplicateStrings(files) return pipeline, nil } diff --git a/shared/token/token.go b/shared/token/token.go index fd0f574c8..d5c48aafd 100644 --- a/shared/token/token.go +++ b/shared/token/token.go @@ -139,19 +139,19 @@ func keyFunc(token *Token, fn SecretFunc) jwt.Keyfunc { // extract the token kind and cast to // the expected type. - kindv, ok := claims["type"] + kind, ok := claims["type"] if !ok { return nil, jwt.ErrInvalidType } - token.Kind, _ = kindv.(string) + token.Kind, _ = kind.(string) // extract the token value and cast to // expected type. - textv, ok := claims["text"] + text, ok := claims["text"] if !ok { return nil, jwt.ErrInvalidType } - token.Text, _ = textv.(string) + token.Text, _ = text.(string) // invoke the callback function to retrieve // the secret key used to verify diff --git a/shared/utils/strings.go b/shared/utils/strings.go index 6add8386e..bbbc33c08 100644 --- a/shared/utils/strings.go +++ b/shared/utils/strings.go @@ -14,8 +14,8 @@ package utils -// DedupStrings deduplicate string list, empty items are dropped -func DedupStrings(src []string) []string { +// DeduplicateStrings deduplicate string list, empty items are dropped +func DeduplicateStrings(src []string) []string { m := make(map[string]struct{}, len(src)) dst := make([]string, 0, len(src)) diff --git a/shared/utils/strings_test.go b/shared/utils/strings_test.go index 393e56cd8..98166c134 100644 --- a/shared/utils/strings_test.go +++ b/shared/utils/strings_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestDedupStrings(t *testing.T) { +func TestDeduplicateStrings(t *testing.T) { tests := []struct { in []string out []string @@ -37,7 +37,7 @@ func TestDedupStrings(t *testing.T) { }} for _, tc := range tests { - result := DedupStrings(tc.in) + result := DeduplicateStrings(tc.in) sort.Strings(result) if len(tc.out) == 0 { assert.Len(t, result, 0)