style: naming convention
This commit is contained in:
32
.clang-tidy
32
.clang-tidy
@@ -1,22 +1,26 @@
|
||||
---
|
||||
# Linux-style naming conventions for C++ projects
|
||||
# C++ Core Guidelines style (CppCoreGuidelines)
|
||||
Checks: >
|
||||
cppcoreguidelines-*,
|
||||
readability-identifier-naming,
|
||||
readability-braces-around-statements,
|
||||
readability-function-size,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
readability-*,
|
||||
modernize-*,
|
||||
performance-*,
|
||||
-modernize-use-trailing-return-type
|
||||
bugprone-*,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-magic-numbers,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast
|
||||
|
||||
CheckOptions:
|
||||
# Classes and structs use CamelCase (C++ convention)
|
||||
# C++ Core Guidelines: Types use PascalCase
|
||||
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.StructCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
|
||||
|
||||
# Functions and methods use snake_case (Linux style)
|
||||
# C++ Core Guidelines: Functions use snake_case (STL style)
|
||||
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.MethodCase, value: lower_case }
|
||||
|
||||
@@ -38,22 +42,18 @@ CheckOptions:
|
||||
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
|
||||
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
|
||||
|
||||
# Global variables: snake_case with g_ prefix (optional, can remove prefix)
|
||||
# Global variables: snake_case (Core Guidelines: avoid globals when possible)
|
||||
- { key: readability-identifier-naming.GlobalVariableCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.GlobalVariablePrefix, value: 'g_' }
|
||||
|
||||
# Namespaces: snake_case
|
||||
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
|
||||
|
||||
# Template parameters: CamelCase
|
||||
# Template parameters: PascalCase (following STL conventions)
|
||||
- { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
|
||||
- { key: readability-identifier-naming.ValueTemplateParameterCase, value: lower_case }
|
||||
|
||||
# Typedef and type aliases: snake_case_t suffix (Linux style)
|
||||
- { key: readability-identifier-naming.TypedefCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.TypedefSuffix, value: '_t' }
|
||||
- { key: readability-identifier-naming.TypeAliasCase, value: lower_case }
|
||||
- { key: readability-identifier-naming.TypeAliasSuffix, value: '_t' }
|
||||
# Type aliases: PascalCase (modern C++ style with 'using')
|
||||
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
|
||||
|
||||
# Function size limits
|
||||
- { key: readability-function-size.LineThreshold, value: 100 }
|
||||
|
||||
Reference in New Issue
Block a user