Skip to content

Commit

Permalink
Merge branch 'main' into refactor/jsonschema
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper authored Nov 4, 2024
2 parents d31e911 + 9a4003b commit 9b5563e
Show file tree
Hide file tree
Showing 78 changed files with 217 additions and 233 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ linters:
- bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully
- contextcheck # check the function whether use a non-inherited context
- dupl # code clone detection
- copyloopvar # checks for loop variables
- errcheck # checks for unchecked errors
- errorlint # find misuses of errors
- exportloopref # check for exported loop vars
- funlen # detects long functions
- gci # consistent import ordering
- goconst # finds repeated strings that could be replaced by a constant
Expand Down Expand Up @@ -169,7 +168,6 @@ issues:
# prevent linters from running on *_test.go files
- path: _test\.go
linters:
- dupl
- funlen
- goconst
- gocyclo
Expand Down
1 change: 0 additions & 1 deletion api/admin/service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code
package admin

import (
Expand Down
1 change: 0 additions & 1 deletion api/admin/step.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with user.go
package admin

import (
Expand Down
1 change: 0 additions & 1 deletion api/admin/user.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code
package admin

import (
Expand Down
4 changes: 2 additions & 2 deletions api/build/enqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ func Enqueue(ctx context.Context, queue queue.Service, db database.Interface, it
l.Debugf("pushing item for build to queue route %s", route)

// push item on to the queue
err = queue.Push(context.Background(), route, byteItem)
err = queue.Push(ctx, route, byteItem)
if err != nil {
l.Errorf("retrying; failed to publish build: %v", err)

err = queue.Push(context.Background(), route, byteItem)
err = queue.Push(ctx, route, byteItem)
if err != nil {
l.Errorf("failed to publish build: %v", err)

Expand Down
1 change: 0 additions & 1 deletion api/log/create_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code to step
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/log/create_step.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code to service
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/log/delete_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with step
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/log/delete_step.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with service
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/log/get_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with step
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/log/get_step.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with service
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/log/update_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with step
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/log/update_step.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with service
package log

import (
Expand Down
1 change: 0 additions & 1 deletion api/pipeline/compile.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with expand
package pipeline

import (
Expand Down
1 change: 0 additions & 1 deletion api/pipeline/expand.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with compile
package pipeline

import (
Expand Down
2 changes: 1 addition & 1 deletion api/repo/repair.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func RepairRepo(c *gin.Context) {
sourceRepo.SetPreviousName(r.GetName())
}

r, err = wh.RenameRepository(ctx, h, sourceRepo, c, m)
r, err = wh.RenameRepository(ctx, l, database.FromContext(c), h, sourceRepo, m)
if err != nil {
util.HandleError(c, http.StatusInternalServerError, err)
return
Expand Down
2 changes: 0 additions & 2 deletions api/types/actions/deploy.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
//
//nolint:dupl // similar code to schedule.go
package actions

import "github.com/go-vela/server/constants"
Expand Down
2 changes: 0 additions & 2 deletions api/types/actions/schedule.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
//
//nolint:dupl // similar code to deploy.go
package actions

import "github.com/go-vela/server/constants"
Expand Down
4 changes: 1 addition & 3 deletions api/types/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Build struct {
func (b *Build) Duration() string {
// check if the build doesn't have a started timestamp
if b.GetStarted() == 0 {
return "..."
return constants.ErrorEmptyDuration
}

// capture started unix timestamp from the build
Expand Down Expand Up @@ -1128,8 +1128,6 @@ func (b *Build) SetApprovedBy(v string) {
}

// String implements the Stringer interface for the Build type.
//
//nolint:dupl // this is duplicated in the test
func (b *Build) String() string {
return fmt.Sprintf(`{
ApprovedAt: %d,
Expand Down
2 changes: 1 addition & 1 deletion api/types/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type Service struct {
func (s *Service) Duration() string {
// check if the service doesn't have a started timestamp
if s.GetStarted() == 0 {
return "..."
return constants.ErrorEmptyDuration
}

// capture started unix timestamp from the service
Expand Down
6 changes: 3 additions & 3 deletions api/types/settings/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "fmt"
type Compiler struct {
CloneImage *string `json:"clone_image,omitempty" yaml:"clone_image,omitempty"`
TemplateDepth *int `json:"template_depth,omitempty" yaml:"template_depth,omitempty"`
StarlarkExecLimit *uint64 `json:"starlark_exec_limit,omitempty" yaml:"starlark_exec_limit,omitempty"`
StarlarkExecLimit *int64 `json:"starlark_exec_limit,omitempty" yaml:"starlark_exec_limit,omitempty"`
}

// GetCloneImage returns the CloneImage field.
Expand Down Expand Up @@ -40,7 +40,7 @@ func (cs *Compiler) GetTemplateDepth() int {
//
// When the provided Compiler type is nil, or the field within
// the type is nil, it returns the zero value for the field.
func (cs *Compiler) GetStarlarkExecLimit() uint64 {
func (cs *Compiler) GetStarlarkExecLimit() int64 {
// return zero value if Compiler type or StarlarkExecLimit field is nil
if cs == nil || cs.StarlarkExecLimit == nil {
return 0
Expand Down Expand Up @@ -79,7 +79,7 @@ func (cs *Compiler) SetTemplateDepth(v int) {
//
// When the provided Compiler type is nil, it
// will set nothing and immediately return.
func (cs *Compiler) SetStarlarkExecLimit(v uint64) {
func (cs *Compiler) SetStarlarkExecLimit(v int64) {
// return if Compiler type is nil
if cs == nil {
return
Expand Down
2 changes: 1 addition & 1 deletion api/types/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Step struct {
func (s *Step) Duration() string {
// check if the step doesn't have a started timestamp
if s.GetStarted() == 0 {
return "..."
return constants.ErrorEmptyDuration
}

// capture started unix timestamp from the step
Expand Down
1 change: 0 additions & 1 deletion api/types/template.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore false positive with build_queue.go
package types

import (
Expand Down
1 change: 0 additions & 1 deletion api/user/create_token.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with delete token
package user

import (
Expand Down
1 change: 0 additions & 1 deletion api/user/delete_token.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//nolint:dupl // ignore similar code with create token
package user

import (
Expand Down
Loading

0 comments on commit 9b5563e

Please sign in to comment.