diff --git a/buf/internal/breaking.bzl b/buf/internal/breaking.bzl index 9511ff2..9767b1c 100644 --- a/buf/internal/breaking.bzl +++ b/buf/internal/breaking.bzl @@ -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: @@ -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, diff --git a/buf/internal/lint.bzl b/buf/internal/lint.bzl index 6947c1f..d8cd049 100644 --- a/buf/internal/lint.bzl +++ b/buf/internal/lint.bzl @@ -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: @@ -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, diff --git a/examples/single_module/BUILD.bazel b/examples/single_module/BUILD.bazel index 8131bb8..17efa4a 100644 --- a/examples/single_module/BUILD.bazel +++ b/examples/single_module/BUILD.bazel @@ -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 = [ diff --git a/examples/single_module/bar/v1/BUILD.bazel b/examples/single_module/bar/v1/BUILD.bazel index 7f00da4..85a7dea 100644 --- a/examples/single_module/bar/v1/BUILD.bazel +++ b/examples/single_module/bar/v1/BUILD.bazel @@ -25,4 +25,5 @@ buf_lint_test( name = "bar_proto_lint", config = "//:buf.yaml", targets = [":bar_proto"], + error_format = "config-ignore-yaml", )