format-code: enable config-clang-tidy format checking
config-clang-tidy has been introduced as a tool for formatting and
modifying `.clang-tidy` files in a consistent way across the
organization. All existing `.clang-tidy` files have been reformatted
already with this tool, so enable running in CI to prevent format
regressions.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I99081c3313faf5514399128416b325f3cdf20323
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index 2982443..5598f13 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -31,6 +31,7 @@
beautysh_sh \
black \
clang_format \
+ clang_tidy \
eslint \
flake8 \
isort \
@@ -110,6 +111,8 @@
# Path to default config files for linters.
CONFIG_PATH="$(git -C "$(dirname "${BASH_SOURCE[0]}")" rev-parse --show-toplevel)/config"
+TOOLS_PATH="$(git -C "$(dirname "${BASH_SOURCE[0]}")" rev-parse --show-toplevel)/tools"
+
# Find repository root for `pwd` or $1.
if [ -z "$1" ]; then
@@ -284,6 +287,12 @@
"${CLANG_FORMAT}" -i "$@"
}
+LINTER_REQUIRE+=([clang_tidy]="true")
+LINTER_TYPES+=([clang_tidy]="clang-tidy-config")
+function do_clang_tidy() {
+ "${TOOLS_PATH}/config-clang-tidy" format
+}
+
function get_file_type()
{
case "$(basename "$1")" in
@@ -302,6 +311,8 @@
# Special files.
.git/COMMIT_EDITMSG) echo "commit" && return ;;
+ .clang-format) echo "clang-format-config" && return ;;
+ .clang-tidy) echo "clang-tidy-config" && return ;;
meson.build) echo "meson" && return ;;
meson.options) echo "meson" && return ;;
esac