style: add cstyle target to Makefile + clang-format config, don't enforce for now

pull/25/head
Pavol Rusnak 6 years ago
parent 324d82507e
commit 7bf30ccb37
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -0,0 +1,3 @@
---
BasedOnStyle: Google
IndentWidth: 4

@ -73,6 +73,8 @@ test_emu: ## run selected device tests from python-trezor
pylint: ## run pylint on application sources and tests
pylint -E $(shell find src tests -name *.py)
## style commands:
style: ## run code style check on application sources and tests
flake8 $(shell find src -name *.py)
isort --check-only $(shell find src -name *.py ! -path 'src/trezor/messages/*')
@ -84,6 +86,9 @@ isort:
black:
black $(shell find src -name *.py ! -path 'src/trezor/messages/*')
cstyle: ## run code style check on low-level C code
./tools/clang-format-check $(shell find embed -type f -name *.[ch])
## build commands:
build: build_boardloader build_bootloader build_firmware build_prodtest build_unix ## build all

@ -0,0 +1,10 @@
#!/bin/sh
error=0
for f in $*; do
changes=$(clang-format -output-replacements-xml "$f" | grep -c '^<replacement ')
if test "$changes" -gt 0; then
echo "$f ... $changes changes needed"
error=1
fi
done
exit $error
Loading…
Cancel
Save