-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds config files for clang-format and clang-tidy
- Loading branch information
Felix "xq" Queißner
committed
Jul 1, 2023
1 parent
be4456c
commit 5c1db2c
Showing
2 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: '' | ||
|
||
# Basic indentation and spacing rules: | ||
IndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
TabWidth: 4 | ||
UseCRLF: false | ||
UseTab: Never | ||
ColumnLimit: 80 | ||
MaxEmptyLinesToKeep: 3 | ||
|
||
IndentCaseLabels: true | ||
IndentCaseBlocks: false | ||
IndentGotoLabels: true | ||
IndentPPDirectives: None | ||
IndentExternBlock: AfterExternBlock | ||
IndentWrappedFunctionNames: true | ||
|
||
AlignConsecutiveAssignments: | ||
# The column at which the = starts is constant among a block of definitions. | ||
Enabled: true | ||
AcrossEmptyLines: true | ||
AcrossComments: true | ||
AlignCompound: true | ||
PadOperators: true | ||
AlignConsecutiveBitFields: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: false | ||
AlignConsecutiveDeclarations: | ||
# The column at which the name starts is constant among a block of declarations / definitions. | ||
Enabled: true | ||
AcrossEmptyLines: true | ||
AcrossComments: false | ||
AlignConsecutiveMacros: | ||
Enabled: true | ||
AcrossEmptyLines: false | ||
AcrossComments: true | ||
|
||
# configure braces and parens: | ||
BraceWrapping: | ||
AfterEnum: false # The { is on the same line as the struct, union or enum keyword. | ||
AfterStruct: false # The { is on the same line as the struct, union or enum keyword. | ||
AfterUnion: false # The { is on the same line as the struct, union or enum keyword. | ||
AfterFunction: false # The { is on the same line as the ). | ||
|
||
AfterCaseLabel: false | ||
AfterControlStatement: Never | ||
|
||
AfterExternBlock: false | ||
BeforeElse: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
|
||
# configure general code: | ||
|
||
# The = has at least one space to the left and one space to the right. | ||
SpaceBeforeAssignmentOperators: true | ||
|
||
# configure pointers: | ||
|
||
PointerAlignment: Right # The * is at the function name and has at least one space from the type before it. | ||
QualifierAlignment: Right # The const is to the left of the type (unless the pointer is also a constant). | ||
SpaceAroundPointerQualifiers: After | ||
|
||
# include sorting: | ||
|
||
SortIncludes: CaseInsensitive | ||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
# External headers | ||
- Regex: '^\<(' | ||
Priority: 3 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
|
||
# System headers | ||
- Regex: '^\<(std.*|inttypes)' | ||
Priority: 2 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
|
||
# Assume project header | ||
- Regex: '^\".*' | ||
Priority: 1 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
|
||
# all other options | ||
|
||
# all arguments on one or on a separate line, use closing parens on separate line | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
AlignAfterOpenBracket: BlockIndent | ||
AllowAllArgumentsOnNextLine: false | ||
|
||
BitFieldColonSpacing: Both # int bf : 2; | ||
|
||
AlignEscapedNewlines: Right | ||
|
||
AllowShortCaseLabelsOnASingleLine: true # don't split up "case x: return value;" | ||
|
||
BreakBeforeTernaryOperators: true | ||
|
||
# default values: | ||
|
||
# AlignArrayOfStructures: None | ||
# AlignOperands: Align | ||
# AlignTrailingComments: true | ||
# AllowAllParametersOfDeclarationOnNextLine: true | ||
# AllowShortEnumsOnASingleLine: true | ||
# AllowShortBlocksOnASingleLine: Never | ||
# AllowShortFunctionsOnASingleLine: None | ||
# AllowShortIfStatementsOnASingleLine: Never | ||
# AllowShortLoopsOnASingleLine: false | ||
# AlwaysBreakAfterDefinitionReturnType: None | ||
# AlwaysBreakAfterReturnType: None | ||
# AlwaysBreakBeforeMultilineStrings: false | ||
# BreakBeforeBinaryOperators: None | ||
# BreakBeforeBraces: Attach | ||
# BreakStringLiterals: true | ||
# CommentPragmas: '^ IWYU pragma:' | ||
|
||
# ExperimentalAutoDetectBinPacking: false | ||
# IncludeIsMainRegex: '(Test)?$' | ||
# IncludeIsMainSourceRegex: '' | ||
# InsertBraces: false | ||
# InsertTrailingCommas: None | ||
# KeepEmptyLinesAtTheStartOfBlocks: true | ||
# ReflowComments: true | ||
# RequiresClausePosition: OwnLine | ||
# SeparateDefinitionBlocks: Leave | ||
|
||
# SpaceAfterCStyleCast: false | ||
# SpaceAfterLogicalNot: false | ||
# SpaceBeforeCaseColon: false | ||
# SpaceBeforeParens: ControlStatements | ||
# SpaceBeforeParensOptions: | ||
# AfterControlStatements: true | ||
# AfterForeachMacros: true | ||
# AfterFunctionDefinitionName: false | ||
# AfterFunctionDeclarationName: false | ||
# AfterIfMacros: true | ||
# AfterOverloadedOperator: false | ||
# AfterRequiresInClause: false | ||
# AfterRequiresInExpression: false | ||
# BeforeNonEmptyParentheses: false | ||
# SpaceBeforeRangeBasedForLoopColon: true | ||
# SpaceInEmptyBlock: false | ||
# SpaceInEmptyParentheses: false | ||
# SpacesBeforeTrailingComments: 1 | ||
# SpacesInAngles: Never | ||
# SpacesInConditionalStatement: false | ||
# SpacesInContainerLiterals: true | ||
# SpacesInCStyleCastParentheses: false | ||
# SpacesInLineCommentPrefix: | ||
# Minimum: 1 | ||
# Maximum: -1 | ||
# SpacesInParentheses: false | ||
# SpacesInSquareBrackets: false | ||
# SpaceBeforeSquareBrackets: false | ||
|
||
# Configure some special macros: | ||
AttributeMacros: | ||
- NORETURN | ||
- PURE | ||
- COLD | ||
- HOT | ||
- FORCEINLINE | ||
- SECTION | ||
WhitespaceSensitiveMacros: | ||
- comptime_stringify | ||
# ForEachMacros: | ||
# - foreach | ||
# - Q_FOREACH | ||
# - BOOST_FOREACH | ||
# IfMacros: | ||
# - KJ_IF_MAYBE | ||
# StatementMacros: | ||
# - Q_UNUSED | ||
# - QT_REQUIRE_VERSION | ||
# StatementAttributeLikeMacros: | ||
# - FALLTHROUGH | ||
# MacroBlockBegin: '' | ||
# MacroBlockEnd: '' | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-identifier-naming,bugprone-*,modernize-*,performance-*' | ||
WarningsAsErrors: '' | ||
HeaderFilterRegex: '' | ||
AnalyzeTemporaryDtors: false | ||
CheckOptions: | ||
|
||
# naming | ||
readability-identifier-naming.StructCase: 'lower_case' | ||
readability-identifier-naming.MemberCase: 'lower_case' | ||
readability-identifier-naming.ConstantCase: 'lower_case' | ||
readability-identifier-naming.ConstantParameterCase: 'lower_case' | ||
readability-identifier-naming.ConstantPointerParameterCase: 'lower_case' | ||
readability-identifier-naming.EnumCase: 'lower_case' | ||
readability-identifier-naming.EnumConstantCase: 'UPPER_CASE' | ||
readability-identifier-naming.FunctionCase: 'lower_case' | ||
readability-identifier-naming.GlobalConstantCase: 'lower_case' | ||
readability-identifier-naming.GlobalConstantPointerCase: 'lower_case' | ||
readability-identifier-naming.GlobalFunctionCase: 'lower_case' | ||
readability-identifier-naming.GlobalPointerCase: 'lower_case' | ||
readability-identifier-naming.GlobalVariableCase: 'lower_case' | ||
readability-identifier-naming.LocalConstantCase: 'lower_case' | ||
readability-identifier-naming.LocalConstantPointerCase: 'lower_case' | ||
readability-identifier-naming.FunctionCase: 'lower_case' | ||
readability-identifier-naming.LocalPointerCase: 'lower_case' | ||
readability-identifier-naming.LocalVariableCase: 'lower_case' | ||
# readability-identifier-naming.MacroDefinitionCase: ['lower_case','UPPER_CASE'] # We cannot use that as we have variable macro casing | ||
readability-identifier-naming.ParameterCase: 'lower_case' | ||
readability-identifier-naming.ParameterPackCase: 'lower_case' | ||
readability-identifier-naming.PointerParameterCase: 'lower_case' | ||
readability-identifier-naming.StaticConstantCase: 'lower_case' | ||
readability-identifier-naming.StaticVariableCase: 'lower_case' | ||
readability-identifier-naming.TypeAliasCase: 'lower_case' | ||
readability-identifier-naming.TypedefCase: 'lower_case' | ||
readability-identifier-naming.TypedefIgnoredRegexp: 'va_list' # regex of accepted violations | ||
readability-identifier-naming.FunctionCase: 'lower_case' | ||
readability-identifier-naming.UnionCase: 'lower_case' | ||
readability-identifier-naming.VariableCase: 'lower_case' | ||
|
||
# Types have no prefix: | ||
readability-identifier-naming.StructPrefix: '' | ||
readability-identifier-naming.UnionPrefix: '' | ||
readability-identifier-naming.EnumPrefix: '' | ||
readability-identifier-naming.TypedefPrefix: '' | ||
|
||
# Types have an '_t' suffix: | ||
readability-identifier-naming.StructSuffix: '_t' | ||
readability-identifier-naming.UnionSuffix: '_t' | ||
readability-identifier-naming.EnumSuffix: '_t' | ||
readability-identifier-naming.TypedefSuffix: '_t' | ||
|
||
|
||
|
||
# defined by default | ||
llvm-else-after-return.WarnOnConditionVariables: 'false' | ||
modernize-loop-convert.MinConfidence: reasonable | ||
modernize-replace-auto-ptr.IncludeStyle: llvm | ||
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false' | ||
google-readability-namespace-comments.ShortNamespaceLines: '10' | ||
cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;' | ||
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false' | ||
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU' | ||
google-readability-braces-around-statements.ShortStatementLines: '1' | ||
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true' | ||
google-readability-namespace-comments.SpacesBeforeComments: '2' | ||
modernize-loop-convert.MaxCopySize: '16' | ||
modernize-pass-by-value.IncludeStyle: llvm | ||
modernize-use-nullptr.NullMacros: 'NULL' | ||
llvm-qualified-auto.AddConstToQualified: 'false' | ||
modernize-loop-convert.NamingStyle: CamelCase | ||
llvm-else-after-return.WarnOnUnfixable: 'false' | ||
google-readability-function-size.StatementThreshold: '800' | ||
|
||
|
||
# lower_case, | ||
# UPPER_CASE, | ||
# camelBack, | ||
# CamelCase, | ||
# camel_Snake_Back, | ||
# Camel_Snake_Case, | ||
# aNy_CasE. | ||
|