From 1a1e0774519990a6f585695a51c79d150073f856 Mon Sep 17 00:00:00 2001 From: Joe Wallwork Date: Tue, 10 Dec 2024 10:12:41 +0000 Subject: [PATCH] Add CMake formatting to pre-commit --- .pre-commit | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit b/.pre-commit index 9d3d9f4d2..af53f8dba 100644 --- a/.pre-commit +++ b/.pre-commit @@ -24,6 +24,11 @@ for FILE in $(git diff --cached --name-only | grep -iE '\.(cpp|cc|h|hpp)$'); do sed -i~ "s/${LINE}/${NEWLINE}/" ${FILE} done +# Apply cmake-lint for linting +for FILE in $(git diff --cached --name-only | grep -i 'CMakeLists.txt'); do + cmake-lint ${FILE} --disabled {C0103,C0113} --line-width 100 +done + # Abort commit if formatting was applied AFTER=$(mktemp) git diff >${AFTER}