Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- Add `textDocument/documentSymbol` support for `buf lsp serve`.
- Fix LSP navigation for cached modules which could cause import paths to become unresolvable.
- Update default value of `--timeout` flag to 0, which results in no timeout by default.
- Update `PROTOVALIDATE` lint rule to allow for custom rules that do not have `id` or `message`
fields.

## [v1.59.0] - 2025-10-20

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ func checkCEL(
break
}
idToConstraintIndices[celID] = append(idToConstraintIndices[celID], i)
} else {
add(i, "%s has an empty %s.id. IDs should always be specified.", parentNameCapitalized, celName)
}
if len(strings.TrimSpace(celConstraint.GetExpression())) == 0 {
add(i, "%s has an empty %s.expression. Expressions should always be specified.", parentNameCapitalized, celName)
Expand All @@ -155,14 +153,6 @@ func checkCEL(
ast, compileIssues := celEnv.Compile(celConstraint.GetExpression())
switch {
case ast.OutputType().IsAssignableType(cel.BoolType):
if celConstraint.GetMessage() == "" {
add(
i,
"%s has an empty %s.message for an expression that evaluates to a boolean. If an expression evaluates to a boolean, a message should always be specified.",
parentNameCapitalized,
celName,
)
}
case ast.OutputType().IsAssignableType(cel.StringType):
if celConstraint.GetMessage() != "" {
add(
Expand Down
2 changes: 0 additions & 2 deletions private/bufpkg/bufcheck/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,14 +627,12 @@ func TestRunProtovalidate(t *testing.T) {
bufanalysistesting.NewFileAnnotation(t, "cel_field.proto", 116, 5, 120, 6, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_field.proto", 156, 5, 160, 6, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 22, 3, 26, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 28, 3, 32, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 34, 3, 38, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 40, 3, 44, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 46, 3, 50, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 52, 3, 56, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 58, 3, 62, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 58, 3, 62, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 64, 3, 68, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 70, 3, 74, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 76, 3, 80, 5, "PROTOVALIDATE"),
bufanalysistesting.NewFileAnnotation(t, "cel_message.proto", 82, 5, 86, 7, "PROTOVALIDATE"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ message MessageTest {
message: "message",
expression: "this == this"
};
// empty id
// empty id UPDATE this is now OK
option (buf.validate.message).cel = {
id: "",
message: "message",
Expand Down Expand Up @@ -60,7 +60,7 @@ message MessageTest {
message: "uh",
expression: "foo + bar",
};
// missing message with a bool expression
// missing message with a bool expression UPDATE: this is now OK
option (buf.validate.message).cel = {
id: "id5",
message: "",
Expand Down