From fa715493b771ace0d3f7ba7d51aa9c128ddf5867 Mon Sep 17 00:00:00 2001 From: David Maul <david.maul@informatik.hs-fulda.de> Date: Thu, 6 Feb 2025 01:36:03 +0100 Subject: [PATCH] add .clang-tidy --- .clang-tidy | 39 +++++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ README.md | 9 +++++++++ 3 files changed, 50 insertions(+) create mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..8a5bc22 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,39 @@ +--- +Checks: > + bugprone-*, + cert-*, + clang-analyzer-*, + cppcoreguidelines-*, + misc-*, + modernize-*, + performance-*, + portability-*, + readability-*, + -modernize-use-trailing-return-type, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-avoid-magic-numbers, + -readability-magic-numbers + +WarningsAsErrors: '' +HeaderFilterRegex: 'src/game/.*' +FormatStyle: file + +CheckOptions: + - key: readability-identifier-naming.ClassCase + value: camelBack + - key: readability-identifier-naming.PrivateMemberPrefix + value: m_ + - key: readability-identifier-naming.MethodCase + value: camelBack + - key: readability-identifier-naming.ParameterCase + value: camelBack + - key: readability-identifier-naming.VariableCase + value: camelBack + - key: readability-identifier-naming.ConstantCase + value: UPPER_CASE + - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic + value: true + - key: performance-move-const-arg.CheckTriviallyCopyableMove + value: false + - key: readability-function-cognitive-complexity.Threshold + value: 25 \ No newline at end of file diff --git a/.gitignore b/.gitignore index cfe2486..77a4686 100644 --- a/.gitignore +++ b/.gitignore @@ -56,5 +56,7 @@ coverage/ docs/generated/ +clang-tidy-warnings.txt + bin/ lib/ diff --git a/README.md b/README.md index e464b3a..30f69d1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # Advanced Wars +## clang-tidy + +- Um `clang-tidy` für eine einzelne Datei (z.B. `main.cpp`) auszuführen: + + `clang-tidy src/game/main.cpp -header-filter="src/game/main\.cpp" -p build/` + +- Um `clang-tidy` für das ganze Projekt auszuführen und die Warnings in die Datei `clang-tidy-warnings.txt` zu schreiben: + + `find src/game -name '*.cpp' -o -name '*.hpp' | xargs clang-tidy -header-filter="src/game/.*" -p build/ 1> clang-tidy-warnings.txt` ## Build-Anleitung ### Linux/MacOS -- GitLab