gpt4 book ai didi

c++ - 哪些 clang-tidy 检查提供自动修复?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:14:23 30 4
gpt4 key购买 nike

我想找出哪些 clang-tidy 检查可以使用 -fix 选项运行,即自动生成固定代码。我知道所有的 modernize-* 检查都可以做到这一点,其他一些检查也可以(比如 google-readability-casting),但我没有找到完整的列表。某处有 list 吗?或者除了阅读每张支票的来源之外还有其他方法可以找出答案?

最佳答案

编辑:自 clang-tidy 10 起,修复选项包含在 documentation. 的检查列表中。

我的其余答案对版本 9 及更低版本仍然有效。


grep --include=\*.cpp -rc './' -e "FixItHint"|grep -v ':0$' > FixItChecks.txt

我在 clang-tidy 源目录中运行了这个 grep 命令。它计算所有 .cpp 文件中“FixItHint”字符串的出现次数,并过滤掉出现次数为零的文件。

clang::FixItHint 是一个类(根据文档):

Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the problem.

我承认获取列表的方法有些粗糙,但是我确实检查了多个文件,结果似乎是正确的。

经过清理和排序的修复检查列表:

abseil/StringFindStartswithCheck
android/CloexecCheck
boost/UseToStringCheck
bugprone/ArgumentCommentCheck
bugprone/BoolPointerImplicitConversionCheck
bugprone/CopyConstructorInitCheck
bugprone/InaccurateEraseCheck
bugprone/MacroParenthesesCheck
bugprone/MisplacedOperatorInStrlenInAllocCheck
bugprone/MoveForwardingReferenceCheck
bugprone/ParentVirtualCallCheck
bugprone/StringIntegerAssignmentCheck
bugprone/SuspiciousMemsetUsageCheck
bugprone/SuspiciousSemicolonCheck
bugprone/SuspiciousStringCompareCheck
bugprone/UnusedRaiiCheck
bugprone/VirtualNearMissCheck
cert/PostfixOperatorCheck
cppcoreguidelines/ProBoundsConstantArrayIndexCheck
cppcoreguidelines/ProTypeCstyleCastCheck
cppcoreguidelines/ProTypeMemberInitCheck
cppcoreguidelines/ProTypeStaticCastDowncastCheck
fuchsia/DefaultArgumentsCheck
fuchsia/RestrictSystemIncludesCheck
google/AvoidCStyleCastsCheck
google/ExplicitConstructorCheck
google/ExplicitMakePairCheck
google/GlobalVariableDeclarationCheck
google/TodoCommentCheck
llvm/IncludeOrderCheck
llvm/TwineLocalCheck
misc/DefinitionsInHeadersCheck
misc/RedundantExpressionCheck
misc/StaticAssertCheck
misc/UniqueptrResetReleaseCheck
misc/UnusedAliasDeclsCheck
misc/UnusedParametersCheck
misc/UnusedUsingDeclsCheck
modernize/AvoidBindCheck
modernize/DeprecatedHeadersCheck
modernize/LoopConvertCheck
modernize/MakeSmartPtrCheck
modernize/PassByValueCheck
modernize/RawStringLiteralCheck
modernize/RedundantVoidArgCheck
modernize/ReplaceAutoPtrCheck
modernize/ReplaceRandomShuffleCheck
modernize/ReturnBracedInitListCheck
modernize/ShrinkToFitCheck
modernize/UnaryStaticAssertCheck
modernize/UseAutoCheck
modernize/UseBoolLiteralsCheck
modernize/UseDefaultMemberInitCheck
modernize/UseEmplaceCheck
modernize/UseEqualsDefaultCheck
modernize/UseEqualsDeleteCheck
modernize/UseNoexceptCheck
modernize/UseNullptrCheck
modernize/UseOverrideCheck
modernize/UseTransparentFunctorsCheck
modernize/UseUncaughtExceptionsCheck
modernize/UseUsingCheck
objc/PropertyDeclarationCheck
performance/FasterStringFindCheck
performance/ForRangeCopyCheck
performance/InefficientAlgorithmCheck
performance/InefficientVectorOperationCheck
performance/MoveConstArgCheck
performance/TypePromotionInMathFnCheck
performance/UnnecessaryCopyInitialization
performance/UnnecessaryValueParamCheck
readability/AvoidConstParamsInDecls
readability/BracesAroundStatementsCheck
readability/ContainerSizeEmptyCheck
readability/DeleteNullPointerCheck
readability/IdentifierNamingCheck
readability/ImplicitBoolConversionCheck
readability/InconsistentDeclarationParameterNameCheck
readability/MisplacedArrayIndexCheck
readability/NamedParameterCheck
readability/NamespaceCommentCheck
readability/NonConstParameterCheck
readability/RedundantControlFlowCheck
readability/RedundantDeclarationCheck
readability/RedundantFunctionPtrDereferenceCheck
readability/RedundantMemberInitCheck
readability/RedundantSmartptrGetCheck
readability/RedundantStringCStrCheck
readability/RedundantStringInitCheck
readability/SimplifyBooleanExprCheck
readability/SimplifySubscriptExprCheck
readability/StaticAccessedThroughInstanceCheck
readability/StaticDefinitionInAnonymousNamespaceCheck
readability/StringCompareCheck
readability/UniqueptrDeleteReleaseCheck

关于c++ - 哪些 clang-tidy 检查提供自动修复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51314792/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com