nighthawk icon indicating copy to clipboard operation
nighthawk copied to clipboard

Run envoy code formatter on proto files

Open dubious90 opened this issue 3 years ago • 0 comments

When we run fix_format script, there is currently a warning that appears:

Please note: `tools/code_format/check_format.py` no longer checks API `.proto` files, please use `tools/proto_format/proto_format.sh` if you are making changes to the API files

We should probably also run this as part of our formatting. However, I believe it requires an upstream change to allow us to access it in bazel. When I tried to run it manually, got:

nbperry@nbperry:~/git/nbperry-nighthawk$ bazel run @envoy//tools/proto_format:proto_format.sh
WARNING: The following configs were expanded more than once: [rbe-toolchain-clang-libc++, rbe-toolchain]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
INFO: Invocation ID: 26035fbf-f9f6-47c0-806b-e611de42ac32
ERROR: Skipping '@envoy//tools/proto_format:proto_format.sh': no such target '@envoy//tools/proto_format:proto_format.sh': target 'proto_format.sh' not declared in package 'tools/proto_format'; however, a source file of this name exists.  (Perhaps add 'exports_files(["proto_format.sh"])' to tools/proto_format/BUILD?) defined by /usr/local/google/home/nbperry/.cache/bazel/_bazel_nbperry/2b135b66df44e56e2b3c6661f277b0d6/external/envoy/tools/proto_format/BUILD
WARNING: Target pattern parsing failed.
ERROR: no such target '@envoy//tools/proto_format:proto_format.sh': target 'proto_format.sh' not declared in package 'tools/proto_format'; however, a source file of this name exists.  (Perhaps add 'exports_files(["proto_format.sh"])' to tools/proto_format/BUILD?) defined by /usr/local/google/home/nbperry/.cache/bazel/_bazel_nbperry/2b135b66df44e56e2b3c6661f277b0d6/external/envoy/tools/proto_format/BUILD
INFO: Elapsed time: 0.602s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
FAILED: Build did NOT complete successfully (1 packages loaded)

But it's possible that I made that command wrong, and that an upstream envoy change is not required.

dubious90 avatar Sep 21 '22 21:09 dubious90