Skip to content

Commit

Permalink
Lint fixes (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristonianJones authored Jun 5, 2024
1 parent fbf5c77 commit eed7db4
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions common/runes/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ func NewBuffer(data string) Buffer {
return buf
}

// NewBuffer returns an efficient implementation of Buffer for the given text based on the ranges of
// the encoded code points contained within, as well as returning the line offsets.
// NewBufferAndLineOffsets returns an efficient implementation of Buffer for the given text based on
// the ranges of the encoded code points contained within, as well as returning the line offsets.
//
// Code points are represented as an array of byte, uint16, or rune. This approach ensures that
// each index represents a code point by itself without needing to use an array of rune. At first
Expand Down
3 changes: 2 additions & 1 deletion ext/sets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import (
"github.com/google/cel-go/checker"
"github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref"
"github.com/google/cel-go/test/proto3pb"

proto3pb "github.com/google/cel-go/test/proto3pb"
)

func TestSets(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion parser/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (p *parserHelper) id(ctx any) int64 {
return id
}

func (p *parserHelper) deleteId(id int64) {
func (p *parserHelper) deleteID(id int64) {
p.sourceInfo.ClearOffsetRange(id)
if id == p.nextID-1 {
p.nextID--
Expand Down
4 changes: 2 additions & 2 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ func (p *parser) expandMacro(exprID int64, function string, target ast.Expr, arg
if loc == nil {
loc = p.helper.getLocation(exprID)
}
p.helper.deleteId(exprID)
p.helper.deleteID(exprID)
return p.reportError(loc, err.Message), true
}
// A nil value from the macro indicates that the macro implementation decided that
Expand All @@ -932,7 +932,7 @@ func (p *parser) expandMacro(exprID int64, function string, target ast.Expr, arg
if p.populateMacroCalls {
p.helper.addMacroCall(expr.ID(), function, target, args...)
}
p.helper.deleteId(exprID)
p.helper.deleteID(exprID)
return expr, true
}

Expand Down
2 changes: 1 addition & 1 deletion policy/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ go_test(
srcs = [
"compiler_test.go",
"config_test.go",
"helper_test.go",
"parser_test.go",
"test.go",
],
data = glob(["testdata/**"]),
embed = [":go_default_library"],
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions policy/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ type TagVisitor interface {
VariableTag(ParserContext, int64, string, *yaml.Node, *Policy, *Variable)
}

// DefaultTagVisitor creates a tag visitor which produces errors for any non-canonical YAML tag.
func DefaultTagVisitor() TagVisitor {
return defaultTagVisitor{}
}
Expand Down
2 changes: 1 addition & 1 deletion policy/testdata/k8s/policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
expression: "resource.labels.?break_glass.orValue('false') == 'true'"
validations:
- expression: >
variables.break_glass ||
variables.break_glass ||
resource.containers.all(c, c.startsWith(variables.env + '.'))
messageExpression: >
'only %s containers are allowed in namespace %s'
Expand Down

0 comments on commit eed7db4

Please sign in to comment.