summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2022-06-24 17:53:24 +0200
committerLéo Lam <leo@leolam.fr>2022-06-30 16:36:10 +0200
commitbd8b3dc61d1cb60fd66554b826d91f4b0d75dda5 (patch)
tree166d4273292119ee95000d82591ad23987779446 /src
parentc93f454e25a10917fdf05e77f6bca548fa19785b (diff)
Add clang-tidy config to help enforce naming conventions
Diffstat (limited to 'src')
-rw-r--r--src/.clang-tidy50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/.clang-tidy b/src/.clang-tidy
new file mode 100644
index 00000000..24abab63
--- /dev/null
+++ b/src/.clang-tidy
@@ -0,0 +1,50 @@
+---
+InheritParentConfig: true
+Checks: 'readability-identifier-naming'
+CheckOptions:
+ # Type names
+ - key: readability-identifier-naming.ClassCase
+ value: CamelCase
+ - key: readability-identifier-naming.StructCase
+ value: CamelCase
+ - key: readability-identifier-naming.UnionCase
+ value: CamelCase
+ - key: readability-identifier-naming.EnumCase
+ value: CamelCase
+ - key: readability-identifier-naming.ClassIgnoredRegexp
+ value: ^hk(.*)
+ - key: readability-identifier-naming.StructIgnoredRegexp
+ value: ^hk(.*)
+ - key: readability-identifier-naming.UnionIgnoredRegexp
+ value: ^hk(.*)
+ - key: readability-identifier-naming.EnumIgnoredRegexp
+ value: ^hk(.*)
+
+ # Variable naming conventions are not enforced as there are many situations
+ # which require deviating from snake_case names.
+
+ # Class/struct members (clang-tidy does not distinguish classes from structs)
+ - key: readability-identifier-naming.MemberCase
+ value: CamelCase
+ - key: readability-identifier-naming.MemberPrefix
+ value: m
+ - key: readability-identifier-naming.MemberIgnoredRegexp
+ value: ^_(.*)
+
+ # Public class/struct members
+ - key: readability-identifier-naming.PublicMemberCase
+ value: lower_case
+ - key: readability-identifier-naming.PublicMemberPrefix
+ value: ''
+ - key: readability-identifier-naming.PublicMemberIgnoredRegexp
+ # clang-tidy does not distinguish classes from structs, so we allow names like mMemberNames
+ # for public members as well (even for structs).
+ value: (^_(.*)|^m[A-Z](.*))
+
+ # Identifier names
+ - key: readability-identifier-naming.MacroDefinitionCase
+ value: UPPER_CASE
+ - key: readability-identifier-naming.ScopedEnumConstantCase
+ value: CamelCase
+ - key: readability-identifier-naming.ScopedEnumConstantIgnoredRegexp
+ value: ^_(.*)