From 2e6197bdf6fb171412077ea212a7f60554ab65e2 Mon Sep 17 00:00:00 2001 From: Jerome Hue Date: Sat, 9 Dec 2023 16:44:55 +0100 Subject: [PATCH] Refactor clang-tidy file for tests Make Tests/.clang-tidy inherits from the parent .clang-tidy. Disable checks for magic number and identifier length --- Tests/.clang-tidy | 180 +------------------------------- Tests/UnitTests/Serial.test.cpp | 4 +- 2 files changed, 6 insertions(+), 178 deletions(-) diff --git a/Tests/.clang-tidy b/Tests/.clang-tidy index d47008da..50ac4ada 100644 --- a/Tests/.clang-tidy +++ b/Tests/.clang-tidy @@ -1,176 +1,4 @@ ---- -Checks: "*,\ - -*magic-numbers*,\ - -abseil-*,\ - -altera-id-dependent-backward-branch,\ - -altera-kernel-name-restriction,\ - -altera-single-work-item-barrier,\ - -altera-struct-pack-align,\ - -altera-unroll-loops,\ - -android-*,\ - -cppcoreguidelines-avoid-non-const-global-variables,\ - -cppcoreguidelines-pro-bounds-constant-array-index,\ - -cppcoreguidelines-pro-type-vararg,\ - -darwin-*,\ - -fuchsia-*,\ - fuchsia-multiple-inheritance,\ - -google-objc-*,\ - -google-readability-todo,\ - -google-readability-namespace-comments,\ - -hicpp-vararg,\ - -linuxkernel-must-use-errs,\ - -llvm-header-guard,\ - -llvm-namespace-comment,\ - -llvmlibc-*,\ - -misc-non-private-member-variables-in-classes,\ - -mpi-*,\ - -openmp-*,\ - -readability-function-cognitive-complexity" -WarningsAsErrors: '' -HeaderFilterRegex: '' -AnalyzeTemporaryDtors: false -FormatStyle: none -CheckOptions: - - key: 'bugprone-argument-comment.StrictMode' - value: 'true' -# Prefer using enum classes with 2 values for parameters instead of bools - - key: 'bugprone-argument-comment.CommentBoolLiterals' - value: 'true' - - key: 'bugprone-misplaced-widening-cast.CheckImplicitCasts' - value: 'true' - - key: 'bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression' - value: 'true' - - key: 'bugprone-suspicious-string-compare.WarnOnLogicalNotComparison' - value: 'true' - - key: 'readability-simplify-boolean-expr.ChainedConditionalReturn' - value: 'true' - - key: 'readability-simplify-boolean-expr.ChainedConditionalAssignment' - value: 'true' - - key: 'readability-uniqueptr-delete-release.PreferResetCall' - value: 'true' - - key: 'cppcoreguidelines-init-variables.MathHeader' - value: '' - - key: 'cppcoreguidelines-narrowing-conversions.PedanticMode' - value: 'true' - - key: 'readability-else-after-return.WarnOnUnfixable' - value: 'true' - - key: 'readability-else-after-return.WarnOnConditionVariables' - value: 'true' - - key: 'readability-identifier-naming.IgnoreMainLikeFunctions' - value: 'true' - - key: 'readability-inconsistent-declaration-parameter-name.Strict' - value: 'true' - - key: 'readability-qualified-auto.AddConstToQualified' - value: 'true' - - key: 'readability-redundant-access-specifiers.CheckFirstDeclaration' - value: 'true' -# These seem to be the most common identifier styles - - key: 'readability-identifier-naming.AbstractClassCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ClassCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ClassConstantCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ClassMemberCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ClassMethodCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ConstantCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ConstantMemberCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ConstantParameterCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ConstantPointerParameterCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ConstexprFunctionCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ConstexprMethodCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ConstexprVariableCase' - value: 'camelBack' - - key: 'readability-identifier-naming.EnumCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.EnumConstantCase' - value: 'camelBack' - - key: 'readability-identifier-naming.FunctionCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.GlobalConstantCase' - value: 'camelBack' - - key: 'readability-identifier-naming.GlobalConstantPointerCase' - value: 'camelBack' - - key: 'readability-identifier-naming.GlobalFunctionCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.GlobalPointerCase' - value: 'camelBack' - - key: 'readability-identifier-naming.GlobalVariableCase' - value: 'camelBack' - # Namespaces should actually be all lower case without underscores - - key: 'readability-identifier-naming.InlineNamespaceCase' - value: 'camelBack' - - key: 'readability-identifier-naming.LocalConstantCase' - value: 'camelBack' - - key: 'readability-identifier-naming.LocalConstantPointerCase' - value: 'camelBack' - - key: 'readability-identifier-naming.LocalPointerCase' - value: 'camelBack' - - key: 'readability-identifier-naming.LocalVariableCase' - value: 'camelBack' - - key: 'readability-identifier-naming.MacroDefinitionCase' - value: 'UPPER_CASE' - - key: 'readability-identifier-naming.MemberCase' - value: 'camelBack' - - key: 'readability-identifier-naming.MethodCase' - value: 'CamelCase' - # Namespaces should actually be all lower case without underscores - - key: 'readability-identifier-naming.NamespaceCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ParameterCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ParameterPackCase' - value: 'camelBack' - - key: 'readability-identifier-naming.PointerParameterCase' - value: 'camelBack' - - key: 'readability-identifier-naming.PrivateMemberCase' - value: 'camelBack' - - key: 'readability-identifier-naming.PrivateMemberSuffix' - value: '_' - - key: 'readability-identifier-naming.PrivateMethodCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ProtectedMemberCase' - value: 'camelBack' - - key: 'readability-identifier-naming.ProtectedMemberSuffix' - value: '_' - - key: 'readability-identifier-naming.ProtectedMethodCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.PublicMemberCase' - value: 'camelBack' - - key: 'readability-identifier-naming.PublicMethodCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ScopedEnumConstantCase' - value: 'camelBack' - - key: 'readability-identifier-naming.StaticConstantCase' - value: 'camelBack' - - key: 'readability-identifier-naming.StaticVariableCase' - value: 'camelBack' - - key: 'readability-identifier-naming.StructCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.TemplateParameterCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.TemplateTemplateParameterCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.TypeAliasCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.TypedefCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.TypeTemplateParameterCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.UnionCase' - value: 'CamelCase' - - key: 'readability-identifier-naming.ValueTemplateParameterCase' - value: 'camelBack' - - key: 'readability-identifier-naming.VariableCase' - value: 'camelBack' - - key: 'readability-identifier-naming.VirtualMethodCase' - value: 'CamelCase' -... +Checks: "-readability-identifier-length, \ + -*magic-numbers*" +InheritParentConfig: true + diff --git a/Tests/UnitTests/Serial.test.cpp b/Tests/UnitTests/Serial.test.cpp index c3dc2e4b..b4fc23cf 100644 --- a/Tests/UnitTests/Serial.test.cpp +++ b/Tests/UnitTests/Serial.test.cpp @@ -289,7 +289,7 @@ TEST_CASE("(De-)Serialize user-defined types (default endian)") REQUIRE(int(sBuffer[4]) == 0x34); REQUIRE(int(sBuffer[5]) == 0x12); - auto s = Deserialize(sBuffer); // NOLINT(readability-identifier-length) + auto s = Deserialize(sBuffer); REQUIRE(s.u16 == 0xABCD); REQUIRE(s.i32 == 0x12345678); } @@ -308,7 +308,7 @@ TEST_CASE("(De-)Serialize user-defined types (big endian)") REQUIRE(int(sBuffer[4]) == 0x56); REQUIRE(int(sBuffer[5]) == 0x78); - auto s = Deserialize(sBuffer); // NOLINT(readability-identifier-length) + auto s = Deserialize(sBuffer); REQUIRE(s.u16 == 0xABCD); REQUIRE(s.i32 == 0x12345678); }