mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-02 05:38:43 +00:00
Add linter misspell (#530)
* Add linter misspell * Fix spelling Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
parent
25bf91bd37
commit
116c310820
19 changed files with 35 additions and 35 deletions
|
@ -1,6 +1,8 @@
|
||||||
linters-settings:
|
linters-settings:
|
||||||
gofmt:
|
gofmt:
|
||||||
simplify: true
|
simplify: true
|
||||||
|
misspell:
|
||||||
|
locale: US
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
|
@ -13,6 +15,7 @@ linters:
|
||||||
- typecheck
|
- typecheck
|
||||||
- errcheck
|
- errcheck
|
||||||
- bidichk
|
- bidichk
|
||||||
|
- misspell
|
||||||
- whitespace
|
- whitespace
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
|
|
@ -98,12 +98,12 @@ func (r *Runner) Run(ctx context.Context) error {
|
||||||
ctx, cancel := context.WithTimeout(ctxmeta, timeout)
|
ctx, cancel := context.WithTimeout(ctxmeta, timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
cancelled := abool.New()
|
canceled := abool.New()
|
||||||
go func() {
|
go func() {
|
||||||
logger.Debug().Msg("listen for cancel signal")
|
logger.Debug().Msg("listen for cancel signal")
|
||||||
|
|
||||||
if werr := r.client.Wait(ctx, work.ID); werr != nil {
|
if werr := r.client.Wait(ctx, work.ID); werr != nil {
|
||||||
cancelled.SetTo(true)
|
canceled.SetTo(true)
|
||||||
logger.Warn().Err(werr).Msg("cancel signal received")
|
logger.Warn().Err(werr).Msg("cancel signal received")
|
||||||
|
|
||||||
cancel()
|
cancel()
|
||||||
|
@ -311,7 +311,7 @@ func (r *Runner) Run(ctx context.Context) error {
|
||||||
state.ExitCode = 1
|
state.ExitCode = 1
|
||||||
state.Error = err.Error()
|
state.Error = err.Error()
|
||||||
}
|
}
|
||||||
if cancelled.IsSet() {
|
if canceled.IsSet() {
|
||||||
state.ExitCode = 137
|
state.ExitCode = 137
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WithContextFunc returns a copy of parent context that is cancelled when
|
// WithContextFunc returns a copy of parent context that is canceled when
|
||||||
// an os interrupt signal is received. The callback function f is invoked
|
// an os interrupt signal is received. The callback function f is invoked
|
||||||
// before cancellation.
|
// before cancellation.
|
||||||
func WithContextFunc(ctx context.Context, f func()) context.Context {
|
func WithContextFunc(ctx context.Context, f func()) context.Context {
|
||||||
|
|
|
@ -155,12 +155,12 @@ func run(c *cli.Context) error {
|
||||||
log.Err(err).Msg("")
|
log.Err(err).Msg("")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
auther := &authorizer{
|
authorizer := &authorizer{
|
||||||
password: c.String("agent-secret"),
|
password: c.String("agent-secret"),
|
||||||
}
|
}
|
||||||
grpcServer := grpc.NewServer(
|
grpcServer := grpc.NewServer(
|
||||||
grpc.StreamInterceptor(auther.streamInterceptor),
|
grpc.StreamInterceptor(authorizer.streamInterceptor),
|
||||||
grpc.UnaryInterceptor(auther.unaryIntercaptor),
|
grpc.UnaryInterceptor(authorizer.unaryIntercaptor),
|
||||||
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||||
MinTime: c.Duration("keepalive-min-time"),
|
MinTime: c.Duration("keepalive-min-time"),
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -12,7 +12,7 @@ var (
|
||||||
|
|
||||||
// ErrCancel is used as a return value when the container execution receives
|
// ErrCancel is used as a return value when the container execution receives
|
||||||
// a cancellation signal from the context.
|
// a cancellation signal from the context.
|
||||||
ErrCancel = errors.New("Cancelled")
|
ErrCancel = errors.New("Canceled")
|
||||||
)
|
)
|
||||||
|
|
||||||
// An ExitError reports an unsuccessful exit.
|
// An ExitError reports an unsuccessful exit.
|
||||||
|
|
|
@ -62,7 +62,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (c *Containers) UnmarshalYAML(value *yaml.Node) error {
|
func (c *Containers) UnmarshalYAML(value *yaml.Node) error {
|
||||||
containers := map[string]Container{}
|
containers := map[string]Container{}
|
||||||
err := value.Decode(&containers)
|
err := value.Decode(&containers)
|
||||||
|
|
|
@ -20,7 +20,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (n *Networks) UnmarshalYAML(value *yaml.Node) error {
|
func (n *Networks) UnmarshalYAML(value *yaml.Node) error {
|
||||||
networks := map[string]Network{}
|
networks := map[string]Network{}
|
||||||
err := value.Decode(&networks)
|
err := value.Decode(&networks)
|
||||||
|
|
|
@ -15,7 +15,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (s *Secrets) UnmarshalYAML(value *yaml.Node) error {
|
func (s *Secrets) UnmarshalYAML(value *yaml.Node) error {
|
||||||
y, _ := yaml.Marshal(value)
|
y, _ := yaml.Marshal(value)
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// StringorInt represents a string or an integer.
|
// StringorInt represents a string or an integer.
|
||||||
type StringorInt int64
|
type StringorInt int64
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (s *StringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
func (s *StringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
var intType int64
|
var intType int64
|
||||||
if err := unmarshal(&intType); err == nil {
|
if err := unmarshal(&intType); err == nil {
|
||||||
|
@ -39,7 +39,7 @@ func (s *StringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
// the String supports notations like 10m for then Megabyte of memory
|
// the String supports notations like 10m for then Megabyte of memory
|
||||||
type MemStringorInt int64
|
type MemStringorInt int64
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (s *MemStringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
func (s *MemStringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
var intType int64
|
var intType int64
|
||||||
if err := unmarshal(&intType); err == nil {
|
if err := unmarshal(&intType); err == nil {
|
||||||
|
@ -62,10 +62,10 @@ func (s *MemStringorInt) UnmarshalYAML(unmarshal func(interface{}) error) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stringorslice represents
|
// Stringorslice represents
|
||||||
// Using engine-api Strslice and augment it with YAML marshalling stuff. a string or an array of strings.
|
// Using engine-api Strslice and augment it with YAML marshaling stuff. a string or an array of strings.
|
||||||
type Stringorslice strslice.StrSlice
|
type Stringorslice strslice.StrSlice
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (s *Stringorslice) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
func (s *Stringorslice) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
var stringType string
|
var stringType string
|
||||||
if err := unmarshal(&stringType); err == nil {
|
if err := unmarshal(&stringType); err == nil {
|
||||||
|
@ -89,7 +89,7 @@ func (s *Stringorslice) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
// SliceorMap represents a slice or a map of strings.
|
// SliceorMap represents a slice or a map of strings.
|
||||||
type SliceorMap map[string]string
|
type SliceorMap map[string]string
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (s *SliceorMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
func (s *SliceorMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
var sliceType []interface{}
|
var sliceType []interface{}
|
||||||
if err := unmarshal(&sliceType); err == nil {
|
if err := unmarshal(&sliceType); err == nil {
|
||||||
|
|
|
@ -21,7 +21,7 @@ func (u Ulimits) MarshalYAML() (interface{}, error) {
|
||||||
return ulimitMap, nil
|
return ulimitMap, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (u *Ulimits) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
func (u *Ulimits) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
ulimits := make(map[string]Ulimit)
|
ulimits := make(map[string]Ulimit)
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ func (v Volumes) MarshalYAML() (interface{}, error) {
|
||||||
return vs, nil
|
return vs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (v *Volumes) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
func (v *Volumes) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
var sliceType []interface{}
|
var sliceType []interface{}
|
||||||
if err := unmarshal(&sliceType); err == nil {
|
if err := unmarshal(&sliceType); err == nil {
|
||||||
|
|
|
@ -20,7 +20,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnmarshalYAML implements the Unmarshaller interface.
|
// UnmarshalYAML implements the Unmarshaler interface.
|
||||||
func (v *Volumes) UnmarshalYAML(value *yaml.Node) error {
|
func (v *Volumes) UnmarshalYAML(value *yaml.Node) error {
|
||||||
y, _ := yaml.Marshal(value)
|
y, _ := yaml.Marshal(value)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ func WithContext(ctx context.Context) context.Context {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithContextFunc returns a copy of parent context that is cancelled when
|
// WithContextFunc returns a copy of parent context that is canceled when
|
||||||
// an os interrupt signal is received. The callback function f is invoked
|
// an os interrupt signal is received. The callback function f is invoked
|
||||||
// before cancellation.
|
// before cancellation.
|
||||||
func WithContextFunc(ctx context.Context, f func()) context.Context {
|
func WithContextFunc(ctx context.Context, f func()) context.Context {
|
||||||
|
|
|
@ -6,9 +6,6 @@ import (
|
||||||
"github.com/woodpecker-ci/woodpecker/pipeline/backend"
|
"github.com/woodpecker-ci/woodpecker/pipeline/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrCancelled signals the pipeline is cancelled.
|
|
||||||
// var ErrCancelled = errors.New("cancelled")
|
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// Filter defines filters for fetching items from the queue.
|
// Filter defines filters for fetching items from the queue.
|
||||||
Filter struct {
|
Filter struct {
|
||||||
|
|
|
@ -251,7 +251,7 @@ func DeleteBuild(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
killedBuild.Procs = model.Tree(procs)
|
killedBuild.Procs = model.Tree(procs)
|
||||||
if err := publishToTopic(c, killedBuild, repo, model.Cancelled); err != nil {
|
if err := publishToTopic(c, killedBuild, repo, model.Canceled); err != nil {
|
||||||
log.Error().Err(err).Msg("publishToTopic")
|
log.Error().Err(err).Msg("publishToTopic")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ package model
|
||||||
type EventType string
|
type EventType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Enqueued EventType = "enqueued"
|
Enqueued EventType = "enqueued"
|
||||||
Started EventType = "started"
|
Started EventType = "started"
|
||||||
Finished EventType = "finished"
|
Finished EventType = "finished"
|
||||||
Cancelled EventType = "cancelled"
|
Canceled EventType = "canceled"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Event represents a build event.
|
// Event represents a build event.
|
||||||
|
|
|
@ -411,13 +411,13 @@ func TestFifoCancel(t *testing.T) {
|
||||||
assert.NoError(t, q.PushAtOnce(noContext, []*Task{task2, task3, task1}))
|
assert.NoError(t, q.PushAtOnce(noContext, []*Task{task2, task3, task1}))
|
||||||
|
|
||||||
_, _ = q.Poll(noContext, func(*Task) bool { return true })
|
_, _ = q.Poll(noContext, func(*Task) bool { return true })
|
||||||
assert.NoError(t, q.Error(noContext, task1.ID, fmt.Errorf("cancelled")))
|
assert.NoError(t, q.Error(noContext, task1.ID, fmt.Errorf("canceled")))
|
||||||
assert.NoError(t, q.Error(noContext, task2.ID, fmt.Errorf("cancelled")))
|
assert.NoError(t, q.Error(noContext, task2.ID, fmt.Errorf("canceled")))
|
||||||
assert.NoError(t, q.Error(noContext, task3.ID, fmt.Errorf("cancelled")))
|
assert.NoError(t, q.Error(noContext, task3.ID, fmt.Errorf("canceled")))
|
||||||
|
|
||||||
info := q.Info(noContext)
|
info := q.Info(noContext)
|
||||||
if len(info.Pending) != 0 {
|
if len(info.Pending) != 0 {
|
||||||
t.Errorf("All pipelines should be cancelled")
|
t.Errorf("All pipelines should be canceled")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ErrCancel indicates the task was cancelled.
|
// ErrCancel indicates the task was canceled.
|
||||||
ErrCancel = errors.New("queue: task cancelled")
|
ErrCancel = errors.New("queue: task canceled")
|
||||||
|
|
||||||
// ErrNotFound indicates the task was not found in the queue.
|
// ErrNotFound indicates the task was not found in the queue.
|
||||||
ErrNotFound = errors.New("queue: task not found")
|
ErrNotFound = errors.New("queue: task not found")
|
||||||
|
|
|
@ -377,7 +377,7 @@ paths:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: Successfully cancelled the Job
|
description: Successfully canceled the Job
|
||||||
404:
|
404:
|
||||||
description: |
|
description: |
|
||||||
Unable to find the Repository or Job
|
Unable to find the Repository or Job
|
||||||
|
|
Loading…
Reference in a new issue