ux: use docker to format proto files (#5384)

## Description

Add a cmd to docker image and use it to format our proto files. This avoids developers the need to install clang-format

Closes: #XXX
This commit is contained in:
Marko
2020-09-22 23:42:55 +02:00
committed by GitHub
parent 0e311abf19
commit 0aecda68fc
7 changed files with 37 additions and 22 deletions

11
.clang-format Normal file
View File

@@ -0,0 +1,11 @@
---
Language: Proto
BasedOnStyle: Google
IndentWidth: 2
ColumnLimit: 0
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
SpacesInSquareBrackets: true
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true

View File

@@ -4,6 +4,5 @@
"--proto_path=${workspaceRoot}/proto",
"--proto_path=${workspaceRoot}/third_party/proto"
]
},
"clang-format.style": "{BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0, AlignConsecutiveAssignments: true, AlignConsecutiveDeclarations: true, SpacesInSquareBrackets: true}",
}
}

View File

@@ -89,6 +89,11 @@ proto-lint:
@$(DOCKER_BUF) check lint --error-format=json
.PHONY: proto-lint
proto-format:
@echo "Formatting Protobuf files"
docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
.PHONY: proto-format
proto-check-breaking:
@$(DOCKER_BUF) check breaking --against-input .git#branch=master
.PHONY: proto-check-breaking