c45e524109
Pase automático de clang-tidy --fix sobre el conjunto de checks que son puro transform de sintaxis y no rompen API. Invocado con --format-style=none para que clang-tidy NO arrastre clang-format sobre las líneas tocadas (evita la regla NamespaceIndentation: All del .clang-format reformateando solo trozos del archivo). Checks aplicados: - modernize-use-trailing-return-type (193 hits): 'int foo()' → 'auto foo() -> int'. Estilo coherente con la convención del proyecto. - modernize-use-default-member-init (36 hits): inicialización de miembros pasa de la lista del constructor a la declaración. Reduce duplicación cuando hay varios constructores con los mismos defaults. - modernize-use-auto (6 hits): tipos largos sustituidos por auto donde el tipo es evidente del contexto (new T, dynamic_cast, etc). - modernize-use-starts-ends-with (2 hits): s.rfind(x) == 0 → s.starts_with(x), aprovechando C++20. - performance-enum-size (10 hits): enums pequeños declaran tipo subyacente (uint8_t / similar) para reducir tamaño y precisar layout. NO aplicado en este pase (riesgo de cambios semánticos o de API): - readability-identifier-naming (renames pueden romper callsites parciales) - readability-convert-member-functions-to-static (cambia firma) - readability-use-anyofallof (reescribe loops, side effects) - readability-function-cognitive-complexity (requiere refactor manual) - bugs reales (bugprone-*, clang-diagnostic-*) → uno a uno Cambios manuales asociados: - SDLManager::clear() ahora devuelve bool: propaga el resultado de beginFrame al caller para que Director::runFrameLoop salte draw+present cuando la swapchain no esté disponible (ventana minimizada). Antes la función ignoraba el [[nodiscard]] del beginFrame y los vértices se acumulaban en el batch sin nadie que los consumiera. - vector_text.cpp: borrada la línea suelta "// Test pre-commit hook" que quedó como cruft. clang-tidy crashea en LLVM 19.1 con performance-noexcept-move-constructor (recursión infinita en ExceptionSpecAnalyzer al procesar std::set); check deshabilitado en .clang-tidy con comentario explicativo. Build limpio, smoke test OK. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
113 lines
5.4 KiB
YAML
113 lines
5.4 KiB
YAML
Checks:
|
|
- readability-*
|
|
- modernize-*
|
|
- performance-*
|
|
- bugprone-*
|
|
- -readability-identifier-length
|
|
- -readability-magic-numbers
|
|
- -bugprone-integer-division
|
|
- -bugprone-easily-swappable-parameters
|
|
- -bugprone-narrowing-conversions
|
|
- -modernize-avoid-c-arrays
|
|
# performance-noexcept-move-constructor crashea clang-tidy (LLVM 19.1)
|
|
# con recursión infinita en ExceptionSpecAnalyzer::analyzeRecord cuando
|
|
# analiza ciertas instanciaciones de std::set. No es un falso positivo
|
|
# sobre nuestro código: el check ni siquiera llega a evaluar el patrón.
|
|
- -performance-noexcept-move-constructor
|
|
|
|
WarningsAsErrors: '*'
|
|
# 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' }
|
|
|
|
# =====================================================================
|
|
# 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 }
|
|
|
|
# Parámetros de función
|
|
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
|
|
|
|
# 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: _ }
|
|
|
|
# =====================================================================
|
|
# MIEMBROS DE CLASE NO-CONST
|
|
# =====================================================================
|
|
# Privados: snake_case con sufijo _
|
|
- { key: readability-identifier-naming.PrivateMemberCase, value: lower_case }
|
|
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
|
|
|
|
# Protegidos: snake_case con sufijo _
|
|
- { key: readability-identifier-naming.ProtectedMemberCase, value: lower_case }
|
|
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
|
|
|
|
# Públicos: snake_case sin sufijo
|
|
- { key: readability-identifier-naming.PublicMemberCase, value: lower_case }
|
|
|
|
# =====================================================================
|
|
# 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 }
|
|
|
|
# Namespaces
|
|
- { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
|
|
|
|
# =====================================================================
|
|
# 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 }
|
|
- { key: readability-identifier-naming.ConstexprMethodCase, value: camelBack }
|