cspell more linting

This commit is contained in:
6543 2024-05-14 03:34:12 +02:00
parent 8b97aa4e8e
commit bacf08747e
12 changed files with 35 additions and 36 deletions

View file

@ -39,6 +39,7 @@
"Refspec",
"Reviewdog",
"Rydzewski",
"SSHURL",
"TARGETARCH",
"TARGETOS",
"Typeflag",
@ -53,7 +54,6 @@
"binutils",
"bitbucketdatacenter",
"bradrydzewski",
"brightbox",
"buildx",
"ccmenu",
"charmbracelet",

View file

@ -78,9 +78,9 @@ func deploy(c *cli.Context) error {
var number int64
if pipelineArg == "last" {
// Fetch the pipeline number from the last pipeline
pipelines, berr := client.PipelineList(repoID)
if berr != nil {
return berr
pipelines, err := client.PipelineList(repoID)
if err != nil {
return err
}
for _, pipeline := range pipelines {
if branch != "" && pipeline.Branch != branch {

View file

@ -146,14 +146,14 @@ func execWithAxis(c *cli.Context, file, repoPath string, axis matrix.Axis) error
if err != nil {
return err
}
confstr, err := tmpl.Execute(func(name string) string {
confStr, err := tmpl.Execute(func(name string) string {
return environ[name]
})
if err != nil {
return err
}
conf, err := yaml.ParseString(confstr)
conf, err := yaml.ParseString(confStr)
if err != nil {
return err
}
@ -177,12 +177,12 @@ func execWithAxis(c *cli.Context, file, repoPath string, axis matrix.Axis) error
}
// lint the yaml file
if lerr := linter.New(linter.WithTrusted(true)).Lint([]*linter.WorkflowConfig{{
if err := linter.New(linter.WithTrusted(true)).Lint([]*linter.WorkflowConfig{{
File: path.Base(file),
RawConfig: confstr,
RawConfig: confStr,
Workflow: conf,
}}); lerr != nil {
return lerr
}}); err != nil {
return err
}
// compiles the yaml file

View file

@ -6,7 +6,7 @@ import (
"os"
"slices"
"github.com/adrg/xdg"
"github.com/adrg/xdg" // cspell:disable-line
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
"github.com/zalando/go-keyring"

View file

@ -35,7 +35,7 @@ func NewClient(c *cli.Context) (woodpecker.Client, error) {
var (
skip = c.Bool("skip-verify")
socks = c.String("socks-proxy")
socksoff = c.Bool("socks-proxy-off")
socksOff = c.Bool("socks-proxy-off")
token = c.String("token")
server = c.String("server")
)
@ -70,7 +70,7 @@ func NewClient(c *cli.Context) (woodpecker.Client, error) {
trans, _ := client.Transport.(*oauth2.Transport)
if len(socks) != 0 && !socksoff {
if len(socks) != 0 && !socksOff {
dialer, err := proxy.SOCKS5("tcp", socks, nil, proxy.Direct)
if err != nil {
return nil, err

View file

@ -22,7 +22,7 @@ import (
"path/filepath"
"strings"
"github.com/muesli/termenv"
"github.com/muesli/termenv" // cspell:words termenv
"github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"

View file

@ -9,7 +9,7 @@ import (
"text/tabwriter"
"unicode"
"github.com/mitchellh/mapstructure"
"github.com/mitchellh/mapstructure" // cspell:words mitchellh mapstructure
)
// NewTable creates a new Table.
@ -64,7 +64,7 @@ func (o *Table) AddFieldFn(field string, fn FieldFn) *Table {
return o
}
// AddAllowedFields reads all first level fieldnames of the struct and allows them to be used.
// AddAllowedFields reads all first level field names of the struct and allows them to be used.
func (o *Table) AddAllowedFields(obj any) (*Table, error) {
v := reflect.ValueOf(obj)
if v.Kind() != reflect.Struct {

View file

@ -73,14 +73,13 @@ func registryCreate(c *cli.Context) error {
}
if strings.HasPrefix(registry.Password, "@") {
path := strings.TrimPrefix(registry.Password, "@")
out, ferr := os.ReadFile(path)
if ferr != nil {
return ferr
out, err := os.ReadFile(path)
if err != nil {
return err
}
registry.Password = string(out)
}
_, err = client.RegistryCreate(repoID, registry)
if err != nil {
if _, err := client.RegistryCreate(repoID, registry); err != nil {
return err
}
return nil

View file

@ -73,9 +73,9 @@ func registryUpdate(c *cli.Context) error {
}
if strings.HasPrefix(registry.Password, "@") {
path := strings.TrimPrefix(registry.Password, "@")
out, ferr := os.ReadFile(path)
if ferr != nil {
return ferr
out, err := os.ReadFile(path)
if err != nil {
return err
}
registry.Password = string(out)
}

View file

@ -106,7 +106,7 @@ func Test_GitLab(t *testing.T) {
})
g.It("Should return repo with push access, when user inherits membership from namespace", func() {
_repo, err := client.Repo(ctx, &user, "6", "brightbox", "puppet")
_repo, err := client.Repo(ctx, &user, "6", "bernt", "puppet")
assert.NoError(t, err)
assert.True(t, _repo.Perm.Push)
})

View file

@ -69,9 +69,9 @@ var allProjectsPayload = []byte(`
"default_branch": "main",
"public": false,
"visibility_level": 0,
"ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
"web_url": "http://example.com/brightbox/puppet",
"ssh_url_to_repo": "git@example.com:bernt/puppet.git",
"http_url_to_repo": "http://example.com/bernt/puppet.git",
"web_url": "http://example.com/bernt/puppet",
"owner": {
"id": 1,
"name": "Brightbox",
@ -81,7 +81,7 @@ var allProjectsPayload = []byte(`
"name": "Puppet",
"name_with_namespace": "Brightbox / Puppet",
"path": "puppet",
"path_with_namespace": "brightbox/puppet",
"path_with_namespace": "bernt/puppet",
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
@ -94,7 +94,7 @@ var allProjectsPayload = []byte(`
"id": 4,
"name": "Brightbox",
"owner_id": 1,
"path": "brightbox",
"path": "bernt",
"updated_at": "2013-09-30T13:46:02Z"
},
"archived": true,
@ -219,9 +219,9 @@ var project6Payload = []byte(`
"default_branch": "main",
"public": false,
"visibility_level": 0,
"ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
"web_url": "http://example.com/brightbox/puppet",
"ssh_url_to_repo": "git@example.com:bernt/puppet.git",
"http_url_to_repo": "http://example.com/bernt/puppet.git",
"web_url": "http://example.com/bernt/puppet",
"owner": {
"id": 1,
"name": "Brightbox",
@ -231,7 +231,7 @@ var project6Payload = []byte(`
"name": "Puppet",
"name_with_namespace": "Brightbox / Puppet",
"path": "puppet",
"path_with_namespace": "brightbox/puppet",
"path_with_namespace": "bernt/puppet",
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
@ -244,7 +244,7 @@ var project6Payload = []byte(`
"id": 4,
"name": "Brightbox",
"owner_id": 1,
"path": "brightbox",
"path": "bernt",
"updated_at": "2013-09-30T13:46:02Z"
},
"archived": false,

View file

@ -45,7 +45,7 @@ func NewServer(t *testing.T) *httptest.Server {
case "/api/v4/projects/diaspora/diaspora-client":
w.Write(project4Payload)
return
case "/api/v4/projects/brightbox/puppet":
case "/api/v4/projects/bernt/puppet":
case "/api/v4/projects/6":
w.Write(project6Payload)
return