From 8ce97aeda3c6ccc3b8841765cc4d5b049e8a8dce Mon Sep 17 00:00:00 2001 From: HYChang Date: Tue, 14 Jul 2020 09:52:41 +0800 Subject: [PATCH] fix(Endpoint): Ignore to format legato project The autoformat hook doesn't need to format the legato project. Add the hooks/format-exclude-list for skip the directory which doesn't need to format by clang-format. Close #713 --- hooks/format-exclude-list | 4 ++++ hooks/formatter | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 hooks/format-exclude-list diff --git a/hooks/format-exclude-list b/hooks/format-exclude-list new file mode 100644 index 00000000..0cd19cb7 --- /dev/null +++ b/hooks/format-exclude-list @@ -0,0 +1,4 @@ +third_party +output_base +legato +_build_endpoint diff --git a/hooks/formatter b/hooks/formatter index 9c2c2006..7c464e25 100755 --- a/hooks/formatter +++ b/hooks/formatter @@ -1,11 +1,11 @@ #!/bin/bash -for file in $(find $(git rev-parse --show-toplevel) | egrep "\.(c|cc|cpp|h|hh|hpp|m|mm)\$" | egrep -v "third_party|output_base"); +for file in $(find $(git rev-parse --show-toplevel) | egrep "\.(c|cc|cpp|h|hh|hpp|m|mm)\$" | egrep -v -f hooks/format-exclude-list) do clang-format -style=file -fallback-style=none -i $file done -for file in $(find $(git rev-parse --show-toplevel) | egrep "\BUILD\$" | egrep -v "third_party|output_base" ) +for file in $(find $(git rev-parse --show-toplevel) | egrep "\BUILD\$" | egrep -v -f hooks/format-exclude-list ) do buildifier $file done