fix(tests): pass context into Compile #598
reviewdog [golangci] report
reported by reviewdog 🐶
Findings (41)
runtime/kubernetes/mock.go|143 col 53| Error return value of (k8s.io/client-go/tools/cache.SharedInformer).AddEventHandler
is not checked (errcheck)
runtime/kubernetes/pod_tracker.go|226 col 40| Error return value of (k8s.io/client-go/tools/cache.SharedInformer).AddEventHandler
is not checked (errcheck)
runtime/kubernetes/build.go|22 col 31| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
runtime/kubernetes/image.go|32 col 30| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
runtime/kubernetes/image.go|39 col 31| unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
runtime/kubernetes/pod_tracker_test.go|184 col 25| unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
runtime/kubernetes/pod_tracker_test.go|258 col 25| unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
runtime/kubernetes/pod_tracker_test.go|327 col 25| unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
runtime/kubernetes/pod_tracker_test.go|373 col 4| expressions should not be cuddled with blocks (wsl)
internal/context/context_test.go|132 col 4| if statements should only be cuddled with assignments (wsl)
internal/context/context_test.go|148 col 4| assignments should only be cuddled with other assignments (wsl)
internal/context/context_test.go|149 col 4| only one cuddle assignment allowed before if statement (wsl)
executor/linux/build_test.go|1100 col 19| unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
executor/linux/build_test.go|1126 col 19| unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
executor/linux/build_test.go|1198 col 19| unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
executor/linux/secret.go|209 col 37| non-wrapping format verb for fmt.Errorf. Use %w
to format errors (errorlint)
executor/linux/secret.go|226 col 37| non-wrapping format verb for fmt.Errorf. Use %w
to format errors (errorlint)
executor/linux/secret.go|243 col 37| non-wrapping format verb for fmt.Errorf. Use %w
to format errors (errorlint)
executor/linux/build_test.go|982 col 4| ranges should only be cuddled with assignments used in the iteration (wsl)
executor/linux/build_test.go|1605 col 4| if statements should only be cuddled with assignments (wsl)
executor/linux/build_test.go|1852 col 4| if statements should only be cuddled with assignments (wsl)
executor/linux/build_test.go|389 col 6| if statements should only be cuddled with assignments used in the if statement itself (wsl)
executor/linux/build_test.go|605 col 4| defer statements should only be cuddled with expressions on same variable (wsl)
executor/linux/build_test.go|987 col 6| if statements should only be cuddled with assignments used in the if statement itself (wsl)
executor/linux/build_test.go|1757 col 4| defer statements should only be cuddled with expressions on same variable (wsl)
executor/linux/build_test.go|342 col 5| only one cuddle assignment allowed before if statement (wsl)
executor/linux/build_test.go|863 col 5| only one cuddle assignment allowed before if statement (wsl)
executor/linux/build_test.go|202 col 4| ranges should only be cuddled with assignments used in the iteration (wsl)
executor/linux/build_test.go|1847 col 6| if statements should only be cuddled with assignments used in the if statement itself (wsl)
executor/linux/build_test.go|1828 col 4| ranges should only be cuddled with assignments used in the iteration (wsl)
executor/linux/build_test.go|322 col 4| defer statements should only be cuddled with expressions on same variable (wsl)
executor/linux/build_test.go|945 col 6| only one cuddle assignment allowed before range statement (wsl)
mock/worker/executor.go|38 col 13| SA1019: library.Executor is deprecated: use Executor from github.com/go-vela/server/api/types instead. (staticcheck)
mock/worker/executor.go|58 col 11| SA1019: library.Executor is deprecated: use Executor from github.com/go-vela/server/api/types instead. (staticcheck)
cmd/vela-worker/exec.go|31 col 1| cyclomatic complexity 31 of func (*Worker).exec
is high (> 30) (gocyclo)
cmd/vela-worker/start.go|61 col 4| return statements should not be cuddled if block has more than two lines (wsl)
cmd/vela-worker/start.go|70 col 3| expressions should not be cuddled with declarations or returns (wsl)
cmd/vela-worker/start.go|50 col 4| assignments should only be cuddled with other assignments (wsl)
cmd/vela-worker/start.go|54 col 4| expressions should not be cuddled with blocks (wsl)
cmd/vela-worker/start.go|57 col 4| assignments should only be cuddled with other assignments (wsl)
cmd/vela-worker/exec.go|30 col 1| directive //nolint:nilerr,funlen // ignore returning nil - don't want to crash worker
is unused for linter "nilerr" (nolintlint)
Filtered Findings (0)
Annotations
Check failure on line 143 in runtime/kubernetes/mock.go
github-actions / golangci
[golangci] runtime/kubernetes/mock.go#L143
Error return value of `(k8s.io/client-go/tools/cache.SharedInformer).AddEventHandler` is not checked (errcheck)
Raw output
runtime/kubernetes/mock.go:143:53: Error return value of `(k8s.io/client-go/tools/cache.SharedInformer).AddEventHandler` is not checked (errcheck)
c.PodTracker.podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
^
Check failure on line 226 in runtime/kubernetes/pod_tracker.go
github-actions / golangci
[golangci] runtime/kubernetes/pod_tracker.go#L226
Error return value of `(k8s.io/client-go/tools/cache.SharedInformer).AddEventHandler` is not checked (errcheck)
Raw output
runtime/kubernetes/pod_tracker.go:226:40: Error return value of `(k8s.io/client-go/tools/cache.SharedInformer).AddEventHandler` is not checked (errcheck)
podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
^
Check failure on line 22 in runtime/kubernetes/build.go
github-actions / golangci
[golangci] runtime/kubernetes/build.go#L22
unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
runtime/kubernetes/build.go:22:31: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (c *client) InspectBuild(ctx context.Context, b *pipeline.Build) ([]byte, error) {
^
Check failure on line 32 in runtime/kubernetes/image.go
github-actions / golangci
[golangci] runtime/kubernetes/image.go#L32
unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
runtime/kubernetes/image.go:32:30: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (c *client) CreateImage(ctx context.Context, ctn *pipeline.Container) error {
^
Check failure on line 39 in runtime/kubernetes/image.go
github-actions / golangci
[golangci] runtime/kubernetes/image.go#L39
unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
runtime/kubernetes/image.go:39:31: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (c *client) InspectImage(ctx context.Context, ctn *pipeline.Container) ([]byte, error) {
^
Check failure on line 184 in runtime/kubernetes/pod_tracker_test.go
github-actions / golangci
[golangci] runtime/kubernetes/pod_tracker_test.go#L184
unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
runtime/kubernetes/pod_tracker_test.go:184:25: unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
t.Run(test.name, func(t *testing.T) {
^
Check failure on line 258 in runtime/kubernetes/pod_tracker_test.go
github-actions / golangci
[golangci] runtime/kubernetes/pod_tracker_test.go#L258
unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
runtime/kubernetes/pod_tracker_test.go:258:25: unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
t.Run(test.name, func(t *testing.T) {
^
Check failure on line 327 in runtime/kubernetes/pod_tracker_test.go
github-actions / golangci
[golangci] runtime/kubernetes/pod_tracker_test.go#L327
unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
runtime/kubernetes/pod_tracker_test.go:327:25: unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
t.Run(test.name, func(t *testing.T) {
^
Check failure on line 373 in runtime/kubernetes/pod_tracker_test.go
github-actions / golangci
[golangci] runtime/kubernetes/pod_tracker_test.go#L373
expressions should not be cuddled with blocks (wsl)
Raw output
runtime/kubernetes/pod_tracker_test.go:373:4: expressions should not be cuddled with blocks (wsl)
tracker.Stop()
^
Check failure on line 132 in internal/context/context_test.go
github-actions / golangci
[golangci] internal/context/context_test.go#L132
if statements should only be cuddled with assignments (wsl)
Raw output
internal/context/context_test.go:132:4: if statements should only be cuddled with assignments (wsl)
if e := ctx.Err(); e != nil {
^
Check failure on line 148 in internal/context/context_test.go
github-actions / golangci
[golangci] internal/context/context_test.go#L148
assignments should only be cuddled with other assignments (wsl)
Raw output
internal/context/context_test.go:148:4: assignments should only be cuddled with other assignments (wsl)
lastLogEntry := loggerHook.LastEntry()
^
Check failure on line 149 in internal/context/context_test.go
github-actions / golangci
[golangci] internal/context/context_test.go#L149
only one cuddle assignment allowed before if statement (wsl)
Raw output
internal/context/context_test.go:149:4: only one cuddle assignment allowed before if statement (wsl)
if lastLogEntry.Message != test.lastLogMessage {
^
Check failure on line 1100 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L1100
unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
executor/linux/build_test.go:1100:19: unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
planFunc: func(c *client) planFuncType {
^
Check failure on line 1126 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L1126
unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
executor/linux/build_test.go:1126:19: unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
planFunc: func(c *client) planFuncType {
^
Check failure on line 1198 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L1198
unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
executor/linux/build_test.go:1198:19: unused-parameter: parameter 'c' seems to be unused, consider removing or renaming it as _ (revive)
planFunc: func(c *client) planFuncType {
^
Check failure on line 209 in executor/linux/secret.go
github-actions / golangci
[golangci] executor/linux/secret.go#L209
non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
Raw output
executor/linux/secret.go:209:37: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
return nil, fmt.Errorf("%s: %w", ErrUnableToRetrieve, err)
^
Check failure on line 226 in executor/linux/secret.go
github-actions / golangci
[golangci] executor/linux/secret.go#L226
non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
Raw output
executor/linux/secret.go:226:37: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
return nil, fmt.Errorf("%s: %w", ErrUnableToRetrieve, err)
^
Check failure on line 243 in executor/linux/secret.go
github-actions / golangci
[golangci] executor/linux/secret.go#L243
non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
Raw output
executor/linux/secret.go:243:37: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
return nil, fmt.Errorf("%s: %w", ErrUnableToRetrieve, err)
^
Check failure on line 982 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L982
ranges should only be cuddled with assignments used in the iteration (wsl)
Raw output
executor/linux/build_test.go:982:4: ranges should only be cuddled with assignments used in the iteration (wsl)
for _, logEntry := range loggerHook.AllEntries() {
^
Check failure on line 1605 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L1605
if statements should only be cuddled with assignments (wsl)
Raw output
executor/linux/build_test.go:1605:4: if statements should only be cuddled with assignments (wsl)
if test.logError && !loggedError {
^
Check failure on line 1852 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L1852
if statements should only be cuddled with assignments (wsl)
Raw output
executor/linux/build_test.go:1852:4: if statements should only be cuddled with assignments (wsl)
if test.logError && !loggedError {
^
Check failure on line 389 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L389
if statements should only be cuddled with assignments used in the if statement itself (wsl)
Raw output
executor/linux/build_test.go:389:6: if statements should only be cuddled with assignments used in the if statement itself (wsl)
if !test.logError {
^
Check failure on line 605 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L605
defer statements should only be cuddled with expressions on same variable (wsl)
Raw output
executor/linux/build_test.go:605:4: defer statements should only be cuddled with expressions on same variable (wsl)
defer loggerHook.Reset()
^
Check failure on line 987 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L987
if statements should only be cuddled with assignments used in the if statement itself (wsl)
Raw output
executor/linux/build_test.go:987:6: if statements should only be cuddled with assignments used in the if statement itself (wsl)
if !test.logError {
^
Check failure on line 1757 in executor/linux/build_test.go
github-actions / golangci
[golangci] executor/linux/build_test.go#L1757
defer statements should only be cuddled with expressions on same variable (wsl)
Raw output
executor/linux/build_test.go:1757:4: defer statements should only be cuddled with expressions on same variable (wsl)
defer loggerHook.Reset()
^