Skip to content
Merged
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
5 changes: 5 additions & 0 deletions buf/internal/breaking.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _buf_breaking_test_impl(ctx):
"limit_to_input_files": ctx.attr.limit_to_input_files,
"exclude_imports": ctx.attr.exclude_imports,
"input_config": ctx.file.config.short_path,
"error_format": ctx.attr.error_format,
})
files_to_include = [ctx.file.against]
if ctx.file.config != None:
Expand Down Expand Up @@ -75,6 +76,10 @@ buf_breaking_test = rule(
default = True,
doc = """Checks are limited to the source files excluding imports from breaking change detection. Please refer to https://docs.buf.build/breaking/protoc-plugin for more details""",
),
"error_format": attr.string(
default = "",
doc = "error-format flag for buf breaking: https://buf.build/docs/reference/cli/buf/breaking#error-format",
),
},
toolchains = [_TOOLCHAIN],
test = True,
Expand Down
5 changes: 5 additions & 0 deletions buf/internal/lint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def _buf_lint_test_impl(ctx):
proto_infos = [t[ProtoInfo] for t in ctx.attr.targets]
config = json.encode({
"input_config": "" if ctx.file.config == None else ctx.file.config.short_path,
"error_format": ctx.attr.error_format,
})
files_to_include = []
if ctx.file.config != None:
Expand All @@ -53,6 +54,10 @@ buf_lint_test = rule(
allow_single_file = True,
doc = "The `buf.yaml` file",
),
"error_format": attr.string(
default = "",
doc = "error-format flag for buf lint: https://buf.build/docs/reference/cli/buf/lint#error-format",
),
},
toolchains = [_TOOLCHAIN],
test = True,
Expand Down
1 change: 1 addition & 0 deletions examples/single_module/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ buf_breaking_test(
# The Image file to check against.
against = "testdata/image.bin",
config = ":buf.yaml",
error_format = "json",
# The proto_library targets to include.
# Refer to the documentation for more on this: https://docs.buf.build/build-systems/bazel#buf-breaking-test
targets = [
Expand Down
1 change: 1 addition & 0 deletions examples/single_module/bar/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ buf_lint_test(
name = "bar_proto_lint",
config = "//:buf.yaml",
targets = [":bar_proto"],
error_format = "config-ignore-yaml",
)