Skip to content

Commit

Permalink
fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
joreiche committed Jun 21, 2024
1 parent 01eec4d commit 985438a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/risks/script/common/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func compare(firstValue Value, secondValue Value) (*Event, error) {
return NewEventFrom(NewNotEqualProperty(second), first, second), nil

case *BoolValue:
if second.BoolValue() == false {
if !second.BoolValue() {
return NewEventFrom(NewEqualProperty(second), first, second), nil
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/risks/script/common/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ func (what *Event) AddHistory(history []*Event) *Event {
return what
}

for _, event := range history {
what.Events = append(what.Events, event)
}
what.Events = append(what.Events, history...)

return what
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/risks/script/common/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (what *Path) Copy() *Path {
}

return &Path{
Path: append(what.Path[:]),
Path: what.Path[:],
}
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/risks/script/expressions/all-expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ func (what *AllExpression) evalBool(scope *common.Scope, inValue common.Value) (
oldItem := scope.PopItem()
defer scope.SetItem(oldItem)

inValue, errorEvalLiteral, evalError := what.in.EvalAny(scope)
if evalError != nil {
return common.EmptyBoolValue(), errorEvalLiteral, evalError
}

switch castValue := inValue.Value().(type) {
case []any:
if what.expression == nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/risks/script/expressions/greater-expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type GreaterExpression struct {
func (what *GreaterExpression) ParseBool(script any) (common.BoolExpression, any, error) {
what.literal = common.ToLiteral(script)

switch script.(type) {
switch castScript := script.(type) {
case map[string]any:
for key, value := range script.(map[string]any) {
for key, value := range castScript {
switch key {
case common.First:
item, errorScript, itemError := new(ValueExpression).ParseValue(value)
Expand Down

0 comments on commit 985438a

Please sign in to comment.