From 6c6a60e980652146f12f668d870762805ceb188f Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Thu, 29 Aug 2024 14:56:07 +0200 Subject: [PATCH] Add linter + clang-format --- .clang-format | 9 +++++++++ lint.sh | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .clang-format create mode 100644 lint.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..b4cc211 --- /dev/null +++ b/.clang-format @@ -0,0 +1,9 @@ +--- +BasedOnStyle: Microsoft +AlignAfterOpenBracket: Align +ConstructorInitializerIndentWidth: '4' +ContinuationIndentWidth: '4' +TabWidth: '4' +UseTab: Never + +... diff --git a/lint.sh b/lint.sh new file mode 100644 index 0000000..414b752 --- /dev/null +++ b/lint.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if (( $# < 1 )); then + >&2 echo "Illegal number of parameters" + exit 1 +fi + +# save unsaved work +git stash --include-untracked + +clang-format -i "$@" + +git add -A && git commit -m "Lint" + +git stash pop