From 5a66669ed8b26ed6730444e3b577ead2b1f97156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Fri, 6 Dec 2024 22:34:13 +0100 Subject: [PATCH] Add clang format and tidy configs --- .clang-format | 31 +++++++++++++++++++++++++++++++ .clang-tidy | 30 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .clang-format create mode 100644 .clang-tidy diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..afa59c0 --- /dev/null +++ b/.clang-format @@ -0,0 +1,31 @@ +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +Language: Cpp +BasedOnStyle: LLVM +AccessModifierOffset: -4 +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +ColumnLimit: 100 +EmptyLineBeforeAccessModifier: Never +FixNamespaceComments: false +IncludeBlocks: Regroup +IncludeCategories: + - Regex: "^<[a-z]*>" + Priority: 1 + - Regex: "^<.*/.*>" + Priority: 2 + - Regex: '^<.*\.hpp>' + Priority: 3 + - Regex: '^<.*\.h>' + Priority: 4 + - Regex: ".*" + Priority: 5 +IndentCaseLabels: true +IndentPPDirectives: BeforeHash +IndentWidth: 4 +InsertNewlineAtEOF: true +NamespaceIndentation: All +PointerAlignment: Left +ReferenceAlignment: Left +SortIncludes: CaseInsensitive +SpaceBeforeCaseColon: true +SpaceBeforeParens: ControlStatements diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..3927b91 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,30 @@ +--- +# Enable all by default, then disable some that have either too many warnings +# at the moment or ones that don't make sense for our codebase +Checks: clang-diagnostic-* + clang-analyzer-* + cppcoreguidelines-* + modernize-* + hicpp-* + -hicpp-special-member-functions + -modernize-pass-by-value + -cppcoreguidelines-pro-bounds-constant-array-index + -modernize-use-trailing-return-type + -cppcoreguidelines-avoid-non-const-global-variables + -hicpp-signed-bitwise + -hicpp-vararg + -hicpp-braces-around-statements + -hicpp-no-array-decay + -cppcoreguidelines-pro-bounds-pointer-arithmetic + -cppcoreguidelines-non-private-member-variables-in-classes + -cppcoreguidelines-avoid-magic-numbers + -cppcoreguidelines-pro-type-vararg + -modernize-avoid-c-arrays + -cppcoreguidelines-avoid-c-arrays + -cppcoreguidelines-pro-bounds-array-to-pointer-decay + -cppcoreguidelines-narrowing-conversions + -clang-analyzer-deadcode.DeadStores +WarningsAsErrors: '*' +HeaderFilterRegex: '' +AnalyzeTemporaryDtors: false +...