diff --git a/.clang-format b/.clang-format index d8067eaade..6a60aeb32b 100644 --- a/.clang-format +++ b/.clang-format @@ -21,4 +21,5 @@ BreakBeforeBraces: Custom BraceWrapping: SplitEmptyFunction: false AfterCaseLabel: true +QualifierAlignment: Left ... diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000..c32d3842fc --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,34 @@ +Checks: 'cert-*, +clang-analyzer-*, +concurrency-*, +cppcoreguidelines-*, +misc-*, +modernize-*, +performance-*, +portability-*, +readability-*, +-cert-env33-c, +-cert-err58-cpp, +-clang-analyzer-optin.cplusplus.VirtualCall, +-cppcoreguidelines-avoid-c-arrays, +-cppcoreguidelines-avoid-do-while, +-cppcoreguidelines-avoid-magic-numbers, +-cppcoreguidelines-avoid-non-const-global-variables, +-cppcoreguidelines-macro-usage, +-cppcoreguidelines-owning-memory, +-cppcoreguidelines-pro-bounds-array-to-pointer-decay, +-cppcoreguidelines-pro-bounds-constant-array-index, +-cppcoreguidelines-pro-bounds-pointer-arithmetic, +-cppcoreguidelines-pro-type-reinterpret-cast, +-cppcoreguidelines-pro-type-const-cast, +-cppcoreguidelines-pro-type-vararg, +-cppcoreguidelines-special-member-functions, +-modernize-avoid-c-arrays, +-modernize-use-trailing-return-type, +-misc-header-include-cycle, +-misc-include-cleaner, +-misc-no-recursion, +-misc-non-private-member-variables-in-classes, +-misc-use-anonymous-namespace, +-readability-function-cognitive-complexity, +-readability-magic-numbers' diff --git a/ci/clang-tidy-all.sh b/ci/clang-tidy-all.sh index c2cd4031c6..3f9a204632 100755 --- a/ci/clang-tidy-all.sh +++ b/ci/clang-tidy-all.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -IGNORE_LIST=".*dirent.* .*DpdkDevice* .*KniDevice* .*MBufRawPacket* .*PfRingDevice* .*RemoteDevice* .*XdpDevice* .*WinPcap*" +IGNORE_LIST=".*dirent.* .*DpdkDevice* .*KniDevice* .*MBufRawPacket* .*PfRingDevice* .*RemoteDevice* .*XdpDevice* .*WinPcap* .*Examples* .*Tests* .*build* .*3rdParty* .*Packet\+\+* .*Pcap\+\+*" SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "${SCRIPT}") @@ -39,5 +39,5 @@ echo "$files" | while IFS= read -r file; do fi done echo "Checking: $file" - clang-tidy "$file" -p $BUILD_DIR --fix --checks=modernize-use-nullptr,modernize-use-override,performance-unnecessary-value-param + clang-tidy "$file" -p $BUILD_DIR --fix-errors done