mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
style: add cstyle target to Makefile + clang-format config, don't enforce for now
This commit is contained in:
parent
324d82507e
commit
7bf30ccb37
3
.clang-format
Normal file
3
.clang-format
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 4
|
5
Makefile
5
Makefile
@ -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
|
||||
|
10
tools/clang-format-check
Executable file
10
tools/clang-format-check
Executable file
@ -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…
Reference in New Issue
Block a user