Merge pull request #3128 from QazCetelic/naming-clang-tidy

Add naming check in `.clang-tidy` file
This commit is contained in:
TheKodeToad 2024-11-24 16:10:41 +00:00 committed by GitHub
commit 835944387b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,23 @@
Checks: Checks:
- modernize-use-using - modernize-use-using
- readability-avoid-const-params-in-decls - readability-avoid-const-params-in-decls
- misc-unused-parameters,
- readability-identifier-naming
SystemHeaders: false # ^ Without unused-parameters the readability-identifier-naming check doesn't cause any warnings.
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: PascalCase }
- { key: readability-identifier-naming.EnumCase, value: PascalCase }
- { key: readability-identifier-naming.FunctionCase, value: camelCase }
- { key: readability-identifier-naming.GlobalVariableCase, value: camelCase }
- { key: readability-identifier-naming.GlobalFunctionCase, value: camelCase }
- { key: readability-identifier-naming.GlobalConstantCase, value: SCREAMING_SNAKE_CASE }
- { key: readability-identifier-naming.MacroDefinitionCase, value: SCREAMING_SNAKE_CASE }
- { key: readability-identifier-naming.ClassMemberCase, value: camelCase }
- { key: readability-identifier-naming.PrivateMemberPrefix, value: m_ }
- { key: readability-identifier-naming.ProtectedMemberPrefix, value: m_ }
- { key: readability-identifier-naming.PrivateStaticMemberPrefix, value: s_ }
- { key: readability-identifier-naming.ProtectedStaticMemberPrefix, value: s_ }
- { key: readability-identifier-naming.PublicStaticConstantCase, value: SCREAMING_SNAKE_CASE }
- { key: readability-identifier-naming.EnumConstantCase, value: SCREAMING_SNAKE_CASE }

View File

@ -4,7 +4,7 @@
All files are formatted with `clang-format` using the configuration in `.clang-format`. Ensure it is run on changed files before committing! All files are formatted with `clang-format` using the configuration in `.clang-format`. Ensure it is run on changed files before committing!
We have no tool for enforcing names but please follow the following conventions for C++: Please also follow the project's conventions for C++:
- Class and type names should be formatted as `PascalCase`: `MyClass`. - Class and type names should be formatted as `PascalCase`: `MyClass`.
- Private or protected class data members should be formatted as `camelCase` prefixed with `m_`: `m_myCounter`. - Private or protected class data members should be formatted as `camelCase` prefixed with `m_`: `m_myCounter`.
@ -16,6 +16,8 @@ We have no tool for enforcing names but please follow the following conventions
- `const` global variables, macros, and enum constants should be formatted as `SCREAMING_SNAKE_CASE`: `LIGHT_GRAY`. - `const` global variables, macros, and enum constants should be formatted as `SCREAMING_SNAKE_CASE`: `LIGHT_GRAY`.
- Avoid inventing acronyms or abbreviations especially for a name of multiple words - like `tp` for `texturePack`. - Avoid inventing acronyms or abbreviations especially for a name of multiple words - like `tp` for `texturePack`.
Most of these rules are included in the `.clang-tidy` file, so you can run `clang-tidy` to check for any violations.
Here is what these conventions with the formatting configuration look like: Here is what these conventions with the formatting configuration look like:
```c++ ```c++