Skip to content

Commit

Permalink
linter updates
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanSussman committed Dec 31, 2024
1 parent 6640868 commit cb24e66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions compiler/types/pipeline/ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"

"github.com/expr-lang/expr"

"github.com/go-vela/server/constants"
)

Expand All @@ -23,7 +24,7 @@ type (
Matcher string `json:"matcher,omitempty" yaml:"matcher,omitempty"`
Operator string `json:"operator,omitempty" yaml:"operator,omitempty"`
Continue bool `json:"continue,omitempty" yaml:"continue,omitempty"`
Eval string `json:"eval,omitempty" yaml:"eval,omitempty"`
Eval string `json:"eval,omitempty" yaml:"eval,omitempty"`
}

// Rules is the pipeline representation of the ruletypes
Expand Down Expand Up @@ -103,12 +104,12 @@ func (r *Ruleset) Match(from *RuleData, envs map[string]string) (bool, error) {
if r.Eval != "" {
eval, err := expr.Compile(r.Eval, expr.Env(envs), expr.AllowUndefinedVariables(), expr.AsBool())
if err != nil {
return false, fmt.Errorf("failed to compile expr of %s: %v", r.Eval, err)
return false, fmt.Errorf("failed to compile expr of %s: %w", r.Eval, err)
}

result, err := expr.Run(eval, envs)
if err != nil {
return false, fmt.Errorf("failed to run expr of %s: %v", r.Eval, err)
return false, fmt.Errorf("failed to run expr of %s: %w", r.Eval, err)
}

bResult, ok := result.(bool)
Expand Down
2 changes: 1 addition & 1 deletion compiler/types/pipeline/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package pipeline
import (
"errors"
"fmt"
"github.com/go-vela/server/compiler/types/raw"
"strings"

"github.com/go-vela/server/compiler/types/raw"
"github.com/go-vela/server/constants"
)

Expand Down

0 comments on commit cb24e66

Please sign in to comment.