diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..65a172a --- /dev/null +++ b/.clang-format @@ -0,0 +1,12 @@ +--- +BasedOnStyle: LLVM +AllowShortBlocksOnASingleLine: 'true' +AllowShortCaseLabelsOnASingleLine: 'true' +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: Inline +AllowShortLoopsOnASingleLine: 'false' +AlwaysBreakBeforeMultilineStrings: 'true' +IndentWidth: '4' + +... diff --git a/tools/format.sh b/tools/format.sh new file mode 100755 index 0000000..ec33b0f --- /dev/null +++ b/tools/format.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ "$OSTYPE" == "darwin"* ]]; then + clang_format_command="clang-format" + clang_tidy_command="run-clang-tidy" +fi +if [[ "$OSTYPE" == "linux"* ]]; then + clang_format_command="clang-format-11" + clang_tidy_command="run-clang-tidy-11" +fi + +eval "$clang_format_command -i *.h *.cpp -style=file" +eval "$clang_tidy_command -fix"