Preparatori per COUP-01. No canvia comportament: només mou les
definicions inline de jail_audio.hpp a un jail_audio.cpp nou, deixant
el .hpp amb declaracions + tipus + constants.
Efectes col·laterals que es tanquen gratis:
- COUP-02: jail_audio deixa de ser header-only. Abans cada TU que
l'incloïa compilava 650 línies inline (amb stb_vorbis.c en mode
HEADER_ONLY). Ara el .hpp té ~130 línies de declaracions.
- PATCH-03: #include "external/stb_vorbis.c" + #undef L/C/R/PLAYBACK_*
viu només al final de jail_audio.cpp. audio.cpp perd el workaround
dels undefs.
Estat intern (current_music, channels[], audio_spec, music_volume,
sound_volume[], music_enabled, sound_enabled, sdl_audio_device,
outgoing_music, incoming_fade) baixa al .cpp dins d'un namespace
anònim (internal linkage). Els helpers privats (feedMusicChunk,
pumpMusic, preFillOutgoing, fadeProgress, update*Fade, updateCurrent*,
stealCurrentIntoOutgoing, forEachTargetChannel) també viuen a
l'anonymous namespace.
Ja::Music i Ja::Sound són públics; el .hpp forward-declara
`struct stb_vorbis` perquè els callers només els agafen per punter.
NOLINT(readability-identifier-naming) al forward-decl perquè el nom
l'imposa stb_vorbis.
jail_audio.cpp s'afegeix a APP_SOURCES al CMakeLists.txt.
.clang-tidy: desactivat clang-analyzer-core.UndefinedBinaryOperatorResult
globalment. Fals positiu conegut a external/stb_vorbis.c que abans no es
disparava (no hi havia TU que cridés directament stb_vorbis_seek_start
des del mateix fitxer on la funció està inlined); ara que jail_audio.cpp
sí que fa aquestes crides directes, el path d'anàlisi passa pel .c i el
check dispara. HeaderFilterRegex no aplica a clang-analyzer-*.
Preparació per COUP-01 (introduir Ja::Engine al commit següent).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
85 lines
3.6 KiB
YAML
85 lines
3.6 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,-warnings-as-errors
|
|
# Fals positiu recurrent en codi C de tercers (source/external/stb_vorbis.c).
|
|
# HeaderFilterRegex no aplica a clang-analyzer-*, així que cal desactivar
|
|
# explícitament. El check inferència sobre variables locals de legacy C
|
|
# genera reports que no reflecteixen bugs reals.
|
|
- -clang-analyzer-core.UndefinedBinaryOperatorResult
|
|
|
|
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' }
|
|
|
|
# Variables locales en snake_case
|
|
- { key: readability-identifier-naming.VariableCase, value: lower_case }
|
|
|
|
# Miembros privados en snake_case con sufijo _
|
|
- { key: readability-identifier-naming.PrivateMemberCase, value: lower_case }
|
|
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
|
|
|
|
# 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
|
|
- { 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 }
|
|
|
|
# Constantes globales en UPPER_CASE
|
|
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
|
|
|
|
# Variables constexpr globales en UPPER_CASE
|
|
- { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_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
|
|
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
|
|
- { key: readability-identifier-naming.StructCase, value: CamelCase }
|
|
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
|
|
|
|
# Valores de enums en UPPER_CASE
|
|
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
|
|
|
|
# Métodos en camelBack (sin sufijos)
|
|
- { 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 }
|