From 6876d71a4d9c3465f0e53e600bda72502059d0b2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 3 Apr 2025 13:25:51 +1000 Subject: [PATCH] Add a clang-tidy file This gives us the ninja clang-tidy command. clang-tidy replaces scan-build and is more featureful (and picky). Part-of: --- .clang-tidy | 5 +++++ .clang-tidy-ignore | 1 + test/.clang-tidy | 6 ++++++ 3 files changed, 12 insertions(+) create mode 100644 .clang-tidy create mode 100644 .clang-tidy-ignore create mode 100644 test/.clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..ad3e652b --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,5 @@ +# optin.core.EnumCastOutOfRange: disabled because we use a lot of "wrong" enum values for testing +# and internally and don't want those values leak into the public API +Checks: > + -clang-analyzer-optin.core.EnumCastOutOfRange +WarningsAsErrors: true diff --git a/.clang-tidy-ignore b/.clang-tidy-ignore new file mode 100644 index 00000000..dc897499 --- /dev/null +++ b/.clang-tidy-ignore @@ -0,0 +1 @@ +include/* diff --git a/test/.clang-tidy b/test/.clang-tidy new file mode 100644 index 00000000..0e198a23 --- /dev/null +++ b/test/.clang-tidy @@ -0,0 +1,6 @@ +# optin.core.FloatLoopCounter: doubles in for loops - it's fine in the tests +# optin.performance.Padding: not a performance concern in the tests +InheritParentConfig: true +Checks: > + -clang-analyzer-security.FloatLoopCounter, + -clang-analyzer-optin.performance.Padding,