diff --git a/.clang-tidy b/.clang-tidy index 91d231a..836f008 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -8,72 +8,100 @@ Checks: - -bugprone-integer-division - -bugprone-easily-swappable-parameters - -bugprone-narrowing-conversions - - -modernize-avoid-c-arrays,-warnings-as-errors + - -modernize-avoid-c-arrays WarningsAsErrors: '*' -# Solo headers del propio código fuente (external/ y spv/ tienen su propio .clang-tidy dummy) -HeaderFilterRegex: 'source/.*' +# Headers nostres (excloem source/external/ que conté dependències de tercers no editables) +HeaderFilterRegex: 'source/(core|game|utils)/' FormatStyle: file CheckOptions: # bugprone-empty-catch: aceptar catches vacíos marcados con @INTENTIONAL en un comentario - { key: bugprone-empty-catch.IgnoreCatchWithKeywords, value: '@INTENTIONAL' } - # Variables locales en snake_case + # ===================================================================== + # CONSTANTES → UPPER_CASE (compile-time y runtime, en cualquier scope) + # ===================================================================== + # Todo lo que sea const o constexpr se identifica visualmente en UPPER_CASE, + # sin importar si es global, local, miembro o static. + + # constexpr en cualquier scope (globales y locales) + - { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE } + + # Constantes globales (const no-constexpr) + - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } + + # Constantes locales (const en función) + - { key: readability-identifier-naming.LocalConstantCase, value: UPPER_CASE } + + # Static const a nivel de archivo/namespace + - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } + + # Miembros static const/constexpr de clase (p.ej. static constexpr int MAX = 100;) + - { key: readability-identifier-naming.ClassConstantCase, value: UPPER_CASE } + + # Miembros const no-static de clase (p.ej. const int limit;) + - { key: readability-identifier-naming.ConstantMemberCase, value: UPPER_CASE } + + # Valores de enums + - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } + + # NOTA: Los parámetros const NO se tratan como constantes aquí. + # Un parámetro sigue siendo un parámetro aunque sea const → hereda ParameterCase. + + # ===================================================================== + # VARIABLES NO-CONST + # ===================================================================== + + # Variables locales - { key: readability-identifier-naming.VariableCase, value: lower_case } + - { key: readability-identifier-naming.LocalVariableCase, value: lower_case } - # Miembros privados en snake_case con sufijo _ - - { key: readability-identifier-naming.PrivateMemberCase, value: lower_case } - - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } + # Parámetros de función + - { key: readability-identifier-naming.ParameterCase, value: lower_case } - # Miembros protegidos en snake_case con sufijo _ - - { key: readability-identifier-naming.ProtectedMemberCase, value: lower_case } - - { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ } - - # Miembros públicos en snake_case (sin sufijo) - - { key: readability-identifier-naming.PublicMemberCase, value: lower_case } - - # Namespaces en CamelCase - - { key: readability-identifier-naming.NamespaceCase, value: CamelCase } - - # Variables estáticas privadas como miembros privados + # Variables estáticas no-const (static locales, static file-scope, + # y static members no-const de clase como el instance_ de un Singleton). + # Sufijo _ para marcar que tienen storage estático. - { key: readability-identifier-naming.StaticVariableCase, value: lower_case } - { key: readability-identifier-naming.StaticVariableSuffix, value: _ } - # Constantes estáticas sin sufijo - - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } + # ===================================================================== + # MIEMBROS DE CLASE NO-CONST + # ===================================================================== + # Privados: snake_case con sufijo _ + - { key: readability-identifier-naming.PrivateMemberCase, value: lower_case } + - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } - # Constantes globales en UPPER_CASE - - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } + # Protegidos: snake_case con sufijo _ + - { key: readability-identifier-naming.ProtectedMemberCase, value: lower_case } + - { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ } - # Variables constexpr globales en UPPER_CASE - - { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE } + # Públicos: snake_case sin sufijo + - { key: readability-identifier-naming.PublicMemberCase, value: lower_case } - # Constantes locales en UPPER_CASE - - { key: readability-identifier-naming.LocalConstantCase, value: UPPER_CASE } - - # Constexpr miembros en UPPER_CASE (sin sufijo) - - { key: readability-identifier-naming.ConstexprMemberCase, value: UPPER_CASE } - - # Constexpr miembros privados/protegidos con sufijo _ - - { key: readability-identifier-naming.ConstexprMethodCase, value: UPPER_CASE } - - # Clases, structs y enums en CamelCase + # ===================================================================== + # TIPOS + # ===================================================================== - { 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 } + - { key: readability-identifier-naming.TypeAliasCase, value: CamelCase } + - { key: readability-identifier-naming.TypedefCase, value: CamelCase } + - { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase } - # Valores de enums en UPPER_CASE - - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } + # Namespaces + - { key: readability-identifier-naming.NamespaceCase, value: CamelCase } - # Métodos en camelBack (sin sufijos) + # ===================================================================== + # FUNCIONES Y MÉTODOS (incluyendo constexpr) + # ===================================================================== + # Un método/función constexpr es un invocable, no una constante → camelBack. + - { key: readability-identifier-naming.FunctionCase, value: camelBack } + - { key: readability-identifier-naming.ConstexprFunctionCase, value: camelBack } - { key: readability-identifier-naming.MethodCase, value: camelBack } - { key: readability-identifier-naming.PrivateMethodCase, value: camelBack } - { key: readability-identifier-naming.ProtectedMethodCase, value: camelBack } - { key: readability-identifier-naming.PublicMethodCase, value: camelBack } - - # Funciones en camelBack - - { key: readability-identifier-naming.FunctionCase, value: camelBack } - - # Parámetros en lower_case - - { key: readability-identifier-naming.ParameterCase, value: lower_case } + - { key: readability-identifier-naming.ConstexprMethodCase, value: camelBack }