From 2351531e842a63e303fb0f4db11fd8a9dee295d9 Mon Sep 17 00:00:00 2001 From: QazCetelic Date: Sat, 23 Nov 2024 18:15:07 +0100 Subject: [PATCH 1/3] Add naming checks to clang-tidy Signed-off-by: QazCetelic --- .clang-tidy | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 436dcf244..9ca89c10f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,23 @@ -Checks: - - modernize-use-using - - readability-avoid-const-params-in-decls +Checks: > + modernize-use-using + 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 } \ No newline at end of file From 14454faac84998b46ae48dcdc0f48a42aea8c325 Mon Sep 17 00:00:00 2001 From: QazCetelic Date: Sat, 23 Nov 2024 18:21:03 +0100 Subject: [PATCH 2/3] Use old list style Signed-off-by: QazCetelic --- .clang-tidy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 9ca89c10f..ef5166da4 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,8 +1,8 @@ -Checks: > - modernize-use-using - readability-avoid-const-params-in-decls - misc-unused-parameters, - readability-identifier-naming +Checks: + - modernize-use-using + - readability-avoid-const-params-in-decls + - misc-unused-parameters, + - readability-identifier-naming # ^ Without unused-parameters the readability-identifier-naming check doesn't cause any warnings. From d927c539b528c48e66b16ff0644a646e3dbaaabe Mon Sep 17 00:00:00 2001 From: QazCetelic Date: Sat, 23 Nov 2024 19:55:40 +0100 Subject: [PATCH 3/3] Update CONTRIBUTING.md conventions section Signed-off-by: QazCetelic --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 713c9ba7c..5965f4d8e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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! -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`. - 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`. - 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: ```c++