From d893eaae320f978c98393443f7890d44acb072dc Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 19 Dec 2021 22:11:53 +0100 Subject: [PATCH] Formatted the entire codebase and added a CI check for formatting --- check_clang_format.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 check_clang_format.sh diff --git a/check_clang_format.sh b/check_clang_format.sh new file mode 100644 index 0000000..872311a --- /dev/null +++ b/check_clang_format.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +echo Searching directories... +CODE_FILES=$(find . -iregex '.*\.\(h\|hpp\|c\|cpp\)$') +while read -r CPP_FILE_PATH; do + # Skip unwanted files + if [[ "$CPP_FILE_PATH" == "./.old"* ]]; then continue; fi + if [[ "$CPP_FILE_PATH" == "./build"* ]]; then continue; fi + if [[ "$CPP_FILE_PATH" == "./core/libcorrect"* ]]; then continue; fi + if [[ "$CPP_FILE_PATH" == "./core/std_replacement"* ]]; then continue; fi + if [[ "$CPP_FILE_PATH" == "./core/src/spdlog"* ]]; then continue; fi + if [[ "$CPP_FILE_PATH" == "./core/src/imgui"* ]]; then continue; fi + if [[ "$CPP_FILE_PATH" == "./misc_modules/discord_integration/discord-rpc"* ]]; then continue; fi + if [[ "$CPP_FILE_PATH" == "./source_modules/sddc_source/src/libsddc"* ]]; then continue; fi + + if [ "$CPP_FILE_PATH" = ./core/src/json.hpp ]; then continue; fi + + echo Checking $CPP_FILE_PATH + clang-format --style=file -i -n -Werror $CPP_FILE_PATH +done <<< "$CODE_FILES" \ No newline at end of file