-
Notifications
You must be signed in to change notification settings - Fork 269
How to format code
Artem Tamazov edited this page Mar 14, 2021
·
9 revisions
Run this script from src/
after each edit to avoid formatting failures:
#!/bin/bash
find . -iname '*.h' \
-o -iname '*.hpp' \
-o -iname '*.cpp' \
-o -iname '*.h.in' \
-o -iname '*.hpp.in' \
-o -iname '*.cpp.in' \
-o -iname '*.cl' \
| grep -v -E '(build/)|(install/)' \
| xargs -n 1 -P $(nproc) -t clang-format-3.8 -style=file -i 2>/dev/null
Note:
| grep -v -E '(build/)|(install/)'
is used to avoid formatting within src/build/
and src/install/
(I use these for building etc.); please fix this line according to your needs.
--atamazov