From 642343d56f51909b3ba196ef3ec1ce39d53ff480 Mon Sep 17 00:00:00 2001 From: trsdy <914137150@qq.com> Date: Fri, 13 Sep 2024 18:32:59 +0800 Subject: [PATCH] - --- .clang-format | 39 ++++++++++++++++++++++++++++ .clang-tidy | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 .clang-format create mode 100644 .clang-tidy diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..76ec29682a --- /dev/null +++ b/.clang-format @@ -0,0 +1,39 @@ +--- +# See all possible options and defaults with: +# clang-format --style=Microsoft --dump-config +BasedOnStyle: Microsoft +Language: Cpp +Standard: c++20 +AccessModifierOffset: -4 +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: All +BreakConstructorInitializers: BeforeColon +ColumnLimit: 0 +CommentPragmas: "NOLINT:.*|^ IWYU pragma:" +IncludeBlocks: Regroup +IndentCaseLabels: true +IndentPPDirectives: AfterHash +# IndentWidth: 4 +SpaceAfterCStyleCast: true +UseTab: Always +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AllowShortLambdasOnASingleLine: Inline +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +BreakBeforeBraces: Allman +DerivePointerAlignment: false +KeepEmptyLinesAtTheStartOfBlocks: false +NamespaceIndentation: None +PointerAlignment: Left +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000..b27c5d7aae --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,71 @@ +FormatStyle: file + +Checks: | + *bugprone*, + *performance*, + clang-analyzer-optin.cplusplus.VirtualCall, + clang-analyzer-optin.performance.Padding, + cppcoreguidelines-slicing, + google-explicit-constructor, + misc-definitions-in-headers, + misc-misplaced-const, + misc-non-copyable-objects, + misc-static-assert, + misc-throw-by-value-catch-by-reference, + misc-uniqueptr-reset-release, + modernize-avoid-bind, + modernize-loop-convert, + modernize-make-unique, + modernize-redundant-void-arg, + modernize-replace-auto-ptr, + modernize-replace-disallow-copy-and-assign-macro, + modernize-replace-random-shuffle, + modernize-shrink-to-fit, + modernize-use-auto, + modernize-use-bool-literals, + modernize-use-default-member-init, + modernize-use-emplace, + modernize-use-equals-default, + modernize-use-equals-delete, + modernize-use-noexcept, + modernize-use-nullptr, + modernize-use-using, + readability-avoid-const-params-in-decls, + readability-const-return-type, + readability-container-size-empty, + readability-delete-null-pointer, + readability-else-after-return, + readability-inconsistent-declaration-parameter-name, + readability-make-member-function-const, + readability-misplaced-array-index, + readability-non-const-parameter, + readability-qualified-auto, + readability-redundant-function-ptr-dereference, + readability-redundant-smartptr-get, + readability-redundant-string-cstr, + readability-simplify-subscript-expr, + readability-static-accessed-through-instance, + readability-static-definition-in-anonymous-namespace, + readability-string-compare, + readability-suspicious-call-argument, + readability-uniqueptr-delete-release, + -bugprone-easily-swappable-parameters, + -bugprone-exception-escape, + -bugprone-reserved-identifier, + -bugprone-unused-raii, +CheckOptions: + - key: modernize-use-equals-default.IgnoreMacros + value: false + - key: performance-for-range-copy.WarnOnAllAutoCopies + value: true + - key: performance-inefficient-string-concatenation.StrictMode + value: true + - key: performance-unnecessary-value-param.AllowedTypes + value: "exception_ptr$;" + - key: readability-implicit-bool-conversion.AllowPointerConditions + value: true + - key: readability-implicit-bool-conversion.AllowIntegerConditions + value: true + - key: readability-braces-around-statements.ShortStatementLines + value: 2 +# HeaderFilterRegex: