Run clang-format on the entire repo
This patch clang-formats the entire repo. Third-party code is
excluded.
I needed to fix up the .clang-format file so that all the header
includes are ordered properly. I could have sworn that it used to work
without the extra modification, but I guess not.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I64bb9f2c795401393f9dfe2fefc4f04cb36b52f6
diff --git a/tools/lint/clang_format.sh b/tools/lint/clang_format.sh
index 3084520..943274d 100755
--- a/tools/lint/clang_format.sh
+++ b/tools/lint/clang_format.sh
@@ -19,11 +19,18 @@
# Find all the C/C++ files in the repo.
# Exclude third-party code. Both in //third_party and the third-party code
# checked in to the main repo directly.
+# Also exclude the pistol grip vtables. Those are likely auto-generated and
+# shouldn't be auto-formatted too.
cc_files=($(git ls-tree --name-only --full-tree -r @ \
| grep -v -e '^third_party/' \
- -e '^motors/core/kinetis.h$' \
- -e '^y2023/vision/rkisp1-config.h$' \
- | (grep -e '\.c$' -e '\.cc$' -e '\.h' || :)))
+ -e '^motors/core/kinetis\.h$' \
+ -e '^motors/core/mk20dx128\.*c$' \
+ -e '^motors/core/nonstd\..*$' \
+ -e '^motors/pistol_grip/vtable_.*\.cc$' \
+ -e '^motors/teensy_loader_cli/' \
+ -e '^motors/usb/usb_' \
+ -e '^y2023/vision/rkisp1-config\.h$' \
+ | (grep -e '\.c$' -e '\.cc$' -e '\.h$' || :)))
# If we have any C/C++ files, format them.
if ((${#cc_files[@]} > 0)); then