metropolis/proto: Add protobuf linting
This adds linting for our proto definitions. All failing linter rules
are currently disabled and will be enabled/fixed in a future commit.
Closes monogon-dev/monogon#7
Change-Id: Ifb9531511f0bc2a0b740722a493d7c3bf8d6d19c
Reviewed-on: https://review.monogon.dev/c/monogon/+/3747
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/proto/BUILD.bazel b/metropolis/proto/BUILD.bazel
index 6db5882..42aecdc 100644
--- a/metropolis/proto/BUILD.bazel
+++ b/metropolis/proto/BUILD.bazel
@@ -1,9 +1,32 @@
+load("@rules_proto_grpc_buf//:defs.bzl", "buf_proto_breaking_test", "buf_proto_lint_test")
load("@rules_proto_grpc_doc//:defs.bzl", "doc_html_compile")
doc_html_compile(
- name = "docs",
+ name = "proto_docs",
protos = [
"//metropolis/proto/api:api_proto",
"//metropolis/proto/common:common_proto",
],
)
+
+buf_proto_lint_test(
+ name = "proto_lint_test",
+ except_rules = [
+ "PACKAGE_VERSION_SUFFIX",
+ "RPC_REQUEST_RESPONSE_UNIQUE",
+ "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
+ "ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
+ "RPC_REQUEST_STANDARD_NAME", # TODO: evaluate correctness
+ "RPC_RESPONSE_STANDARD_NAME", # TODO: evaluate correctness
+ "SERVICE_SUFFIX", # TODO: evaluate correctness
+ "FIELD_LOWER_SNAKE_CASE", # TODO: evaluate correctness
+ ],
+ protos = [
+ "//metropolis/proto/api:api_proto",
+ "//metropolis/proto/common:common_proto",
+ ],
+ use_rules = [
+ "DEFAULT",
+ "COMMENTS",
+ ],
+)