クラスおよびメソッド命名規則の適用優先順位、用途別命名、禁止パターン、安全なリネーム運用ガイド
共通規約は .github/copilot-instructions.md を参照してください。
この文書は、プロジェクト内で命名規則を統一するためのガイドラインです。命名の一貫性は、可読性と保守性の向上につながります。
snake_case なら追従)。MyClass)。snake_case を使用する(例: my_method、my_variable)。MAX_SIZE、MY_CONSTANT)。my_module.py)。test_test_my_function_ で始める(例: _private_variable、_helper_method)。_ で始める。g_ プレフィックスを使用する(例: g_global_variable)。_ プレフィックスで明示する。snake_case で統一されている箇所では、新規追加・修正も同じ規則に合わせる。| 分類 | サフィックス | 例 |
|---|---|---|
| コンポーネント | Component | ChatEventsComponent, TTSServiceComponent |
| マネージャー | Manager | TransManager, TTSManager, STTManager |
| インターフェース(STT/Trans) | Interface サフィックス | STTInterface, TransInterface |
| インターフェース(TTS) | Interface(クラス名そのもの) | Interface(src/core/tts/tts_interface.py) |
| エンジン実装 | キャメルケース | VoiceVox, DeeplTranslation, GoogleCloudSpeechToText |
| 例外クラス | Error サフィックス | TTSExceptionError, TranslateExceptionError, STTExceptionError |
Interface というクラス名になっており、新規エンジンはこのクラスを継承する。Component サフィックスを付けるが、準大号コンポーネント(SynthesisManager など)はマネージャー内部の複数管理クラスであり Component サフィックスは付けない。get_ / fetch_ を使う(例: fetch_user_profile)。set_ を使う(例: set_voice_config)。add_、削除系は remove_ を使う。is_ / has_ / can_ を使う。on_ を使う(例: on_chat_message)。calculate_total は calc より明確)。URL は可、usr は不可)。get_users、get_items)。data, info, manager2 など)。str_name, list_items など)。a, tmp, val)。user_id と userid の混在)。test_...)を満たしていること。user_id/userid)が増えていないこと。snake_case になっているか。test_ で始まっているか。_ で始まっているか。g_ を使用しているか)。