Add and update name convention
Some checks failed
Continuous Integration / Code Formatting (push) Successful in 30s
Continuous Integration / Code Quality Check (push) Successful in 30s
Continuous Integration / Test Execution (push) Failing after 17s
Continuous Integration / CI Summary (push) Failing after 4s

This commit is contained in:
2025-09-30 00:09:55 +04:00
parent 61951a047b
commit 5275c5ca94
57 changed files with 455 additions and 68 deletions

View File

@@ -28,7 +28,7 @@ Guidance for Claude Code (claude.ai/code) when working with this repository.
- Invalid swaps automatically revert after animation
- State machine: WAITING → SELECTING → SWAPPING → PROCESSING
- Test scripts located in `tests/` directory for system validation
- Use `test_logging.gd` to validate the logging system functionality
- Use `TestLogging.gd` to validate the logging system functionality
### Audio Configuration
- Music: Located in `assets/audio/music/` directory with loop configuration in AudioManager
@@ -111,7 +111,7 @@ Guidance for Claude Code (claude.ai/code) when working with this repository.
- `src/autoloads/SettingsManager.gd` - Settings management with input validation and security
- `src/autoloads/DebugManager.gd` - Debug system integration
- `scenes/game/game.gd` - Main game scene with modular gameplay system
- `scenes/game/gameplays/match3_gameplay.gd` - Match-3 implementation with input validation
- `scenes/game/gameplays/Match3Gameplay.gd` - Match-3 implementation with input validation
- `scenes/game/gameplays/tile.gd` - Instance-based tile behavior without global state
- `scenes/ui/DebugMenuBase.gd` - Unified debug menu base class
- `scenes/ui/SettingsMenu.gd` - Settings UI with input validation
@@ -123,8 +123,9 @@ Guidance for Claude Code (claude.ai/code) when working with this repository.
### Before Making Changes
1. Check `docs/MAP.md` for architecture
2. Review `docs/CODE_OF_CONDUCT.md` for coding standards
3. Understand existing patterns before implementing features
4. If adding assets, prepare `assets/sources.yaml` documentation
3. **Review naming conventions**: See [Naming Convention Quick Reference](CODE_OF_CONDUCT.md#naming-convention-quick-reference) for all file and code naming standards
4. Understand existing patterns before implementing features
5. If adding assets, prepare `assets/sources.yaml` documentation following [asset naming conventions](CODE_OF_CONDUCT.md#5-asset-file-naming)
### Testing Changes
- Run project with F5 in Godot Editor
@@ -132,10 +133,10 @@ Guidance for Claude Code (claude.ai/code) when working with this repository.
- Verify scene transitions work
- Check mobile compatibility if UI changes made
- Use test scripts from `tests/` directory to validate functionality
- Run `test_logging.gd` after logging system changes
- Run `TestLogging.gd` after logging system changes
- **Save system testing**: Run save/load test suites after SaveManager changes
- **Checksum validation**: Test `test_checksum_issue.gd` to verify deterministic checksums
- **Migration compatibility**: Run `test_migration_compatibility.gd` for version upgrades
- **Migration compatibility**: Run `TestMigrationCompatibility.gd` for version upgrades
### Common Implementation Patterns
- **Scene transitions**: Use `GameManager.start_game_with_mode()` with built-in validation

View File

@@ -27,6 +27,9 @@ Coding standards and development practices for the Skelly project. These guideli
## GDScript Coding Standards
### Naming Conventions
> 📋 **Quick Reference**: For complete naming convention details, see the **[Naming Convention Quick Reference](#naming-convention-quick-reference)** section below.
```gdscript
# Variables and functions: snake_case
var player_health: int = 100
@@ -39,6 +42,11 @@ const TILE_SPACING := 54
# Classes: PascalCase
class_name PlayerController
# Scene files (.tscn) and Script files (.gd): PascalCase
# MainMenu.tscn, MainMenu.gd
# Match3Gameplay.tscn, Match3Gameplay.gd
# TestAudioManager.gd (test files)
# Signals: past_tense
signal health_changed
signal game_started
@@ -100,7 +108,7 @@ func _get_match_line(start: Vector2i, dir: Vector2i) -> Array:
GameManager.start_match3_game()
# ❌ Wrong
get_tree().change_scene_to_file("res://scenes/game.tscn")
get_tree().change_scene_to_file("res://scenes/game/Game.tscn")
```
### Autoload Usage
@@ -263,6 +271,207 @@ wip
- Verify debug state persists across scene changes
- Check debug code doesn't affect release builds
## Naming Convention Quick Reference
> 🎯 **Single Source of Truth**: This section contains all naming conventions for the Skelly project. All other documentation files reference this section to avoid duplication and ensure consistency.
### 1. GDScript Code Elements
```gdscript
# Variables and functions: snake_case
var player_health: int = 100
func calculate_damage() -> int:
# Constants: SCREAMING_SNAKE_CASE
const MAX_HEALTH := 100
const TILE_SPACING := 54
# Classes: PascalCase
class_name PlayerController
# Signals: past_tense_with_underscores
signal health_changed
signal game_started
signal match_found
# Private functions: prefix with underscore
func _ready():
func _initialize_grid():
```
### 2. File Naming Standards
#### Script and Scene Files
```gdscript
# ✅ Correct: All .gd and .tscn files use PascalCase
MainMenu.tscn / MainMenu.gd
Match3Gameplay.tscn / Match3Gameplay.gd
ClickomaniaGameplay.tscn / ClickomaniaGameplay.gd
ValueStepper.tscn / ValueStepper.gd
# Test files: PascalCase with "Test" prefix
TestAudioManager.gd
TestGameManager.gd
TestMatch3Gameplay.gd
# ❌ Wrong: Old snake_case style (being migrated)
main_menu.tscn / main_menu.gd
TestAudioManager.gd
```
**Rules:**
- Scene files (.tscn) must match their script file name exactly
- All new files must use PascalCase
- Test files use "Test" prefix + PascalCase
- Autoload scripts follow PascalCase (GameManager.gd, AudioManager.gd)
### 3. Directory Naming Conventions
#### Source Code Directories
```
# Source directories: snake_case
src/autoloads/
scenes/game/gameplays/
scenes/ui/components/
tests/helpers/
# Root directories: lowercase
docs/
tests/
tools/
data/
```
#### Asset Directories
```
# Asset directories: kebab-case
assets/audio-files/
assets/ui-sprites/
assets/game-textures/
assets/fonts/
localization/
```
### 4. Resource and Configuration Files
```bash
# Configuration files: lowercase with dots
project.godot
gdlintrc
.gdformatrc
.editorconfig
export_presets.cfg
# Godot resource files (.tres): PascalCase
data/DefaultBusLayout.tres
data/PlayerSaveData.tres
scenes/ui/DefaultTheme.tres
# Asset metadata: kebab-case
assets/asset-sources.yaml
assets/audio-files/audio-sources.yaml
assets/ui-sprites/sprite-sources.yaml
# Development files: kebab-case
requirements.txt
development-tools.md
```
### 5. Asset File Naming
```bash
# Audio files: kebab-case in kebab-case directories
assets/audio-files/background-music.ogg
assets/audio-files/ui-sounds/button-click.wav
assets/audio-files/game-sounds/match-sound.wav
# Visual assets: kebab-case
assets/ui-sprites/main-menu-background.png
assets/game-textures/gem-blue.png
assets/fonts/main-ui-font.ttf
# Import settings: match the original file
background-music.ogg.import
button-click.wav.import
```
**Asset Rules:**
- All asset files use kebab-case
- Organized in kebab-case directories
- Import files automatically match asset names
- Document all assets in `asset-sources.yaml`
### 6. Git Workflow Conventions
#### Branch Naming
```bash
# Feature branches: feature/description-with-hyphens
feature/new-gameplay-mode
feature/settings-ui-improvement
feature/audio-system-upgrade
# Bug fixes: fix/description-with-hyphens
fix/tile-positioning-bug
fix/save-data-corruption
fix/debug-menu-visibility
# Refactoring: refactor/component-name
refactor/match3-input-system
refactor/autoload-structure
# Documentation: docs/section-name
docs/code-of-conduct-update
docs/api-documentation
```
#### Commit Message Format
```bash
# Format: <type>: <description>
# Examples:
feat: add dark mode toggle to settings menu
fix: resolve tile swap animation timing issue
docs: update naming conventions in code of conduct
refactor: migrate print statements to DebugManager
test: add comprehensive match3 validation tests
```
### 7. Quick Reference Summary
| File Type | Convention | Example |
|-----------|------------|---------|
| **GDScript Files** | PascalCase | `MainMenu.gd`, `AudioManager.gd` |
| **Scene Files** | PascalCase | `MainMenu.tscn`, `Match3Gameplay.tscn` |
| **Test Files** | Test + PascalCase | `TestAudioManager.gd` |
| **Variables/Functions** | snake_case | `player_health`, `calculate_damage()` |
| **Constants** | SCREAMING_SNAKE_CASE | `MAX_HEALTH`, `TILE_SPACING` |
| **Classes** | PascalCase | `class_name PlayerController` |
| **Signals** | past_tense | `health_changed`, `game_started` |
| **Directories** | snake_case (src) / kebab-case (assets) | `src/autoloads/`, `assets/audio-files/` |
| **Assets** | kebab-case | `background-music.ogg`, `gem-blue.png` |
| **Config Files** | lowercase.extension | `project.godot`, `.gdformatrc` |
| **Branches** | type/kebab-case | `feature/new-gameplay`, `fix/tile-bug` |
> ✅ **Status**: All major file naming inconsistencies have been resolved. The project now follows consistent PascalCase naming for all .gd and .tscn files.
### 8. File Renaming Migration Guide
When renaming files to follow conventions:
**Step-by-step procedure:**
1. **Use Git rename**: `git mv old_file.gd NewFile.gd` (preserves history)
2. **Update .tscn references**: Modify script path in scene files
3. **Update code references**: Search and replace all `preload()` and `load()` statements
4. **Update project.godot**: If file is referenced in autoloads or project settings
5. **Update documentation**: Search all .md files for old references
6. **Update test files**: Modify any test files that reference the renamed file
7. **Run validation**: Execute `gdlint`, `gdformat`, and project tests
8. **Verify in editor**: Load scenes in Godot editor to confirm everything works
**Tools for validation:**
- `python tools/run_development.py --test` - Run all tests
- `python tools/run_development.py --lint` - Check code quality
- `python tools/run_development.py --format` - Ensure consistent formatting
## Common Mistakes to Avoid
### Architecture Violations
@@ -271,7 +480,7 @@ wip
get_tree().change_scene_to_file("some_scene.tscn")
# Don't hardcode paths
var tile = load("res://scenes/game/gameplays/tile.tscn")
var tile = load("res://scenes/game/gameplays/Tile.tscn")
# Don't ignore null checks
var node = get_node("SomeNode")

View File

@@ -2,6 +2,8 @@
This document outlines the code quality standards implemented in the Skelly project and provides guidelines for maintaining high-quality, reliable code.
> 📋 **Naming Standards**: All code follows the [Naming Convention Quick Reference](CODE_OF_CONDUCT.md#naming-convention-quick-reference) for consistent file, class, and variable naming.
## Overview of Improvements
A comprehensive code quality improvement was conducted to eliminate critical flaws, improve maintainability, and ensure production-ready reliability. The improvements focus on memory safety, error handling, architecture quality, and input validation.
@@ -28,7 +30,7 @@ for child in children_to_remove:
```
**Files Improved:**
- `scenes/game/gameplays/match3_gameplay.gd`
- `scenes/game/gameplays/Match3Gameplay.gd`
- `scenes/game/gameplays/tile.gd`
### 2. Error Handling & Recovery
@@ -111,7 +113,7 @@ static func set_active_gem_pool(gem_indices: Array) -> void:
**Files Improved:**
- `scenes/game/gameplays/tile.gd`
- `scenes/game/gameplays/match3_gameplay.gd`
- `scenes/game/gameplays/Match3Gameplay.gd`
## 🟡 Code Quality Improvements
@@ -173,7 +175,7 @@ func _move_cursor(direction: Vector2i) -> void:
**Files Improved:**
- `scenes/ui/SettingsMenu.gd`
- `scenes/game/gameplays/match3_gameplay.gd`
- `scenes/game/gameplays/Match3Gameplay.gd`
- `src/autoloads/GameManager.gd`
## Development Standards

View File

@@ -3,6 +3,8 @@
## Overview
Skelly is a Godot 4.4 game project featuring multiple gameplay modes. The project supports match-3 puzzle gameplay with planned clickomania gameplay through a modular gameplay architecture. It follows a modular structure with clear separation between scenes, autoloads, assets, and data.
> 📋 **Naming Conventions**: All file and directory naming follows the standards defined in [Naming Convention Quick Reference](CODE_OF_CONDUCT.md#naming-convention-quick-reference).
## Project Root Structure
```
@@ -150,8 +152,8 @@ The game now uses a modular gameplay architecture where different game modes can
### Current Gameplay Modes
#### Match-3 Mode (`scenes/game/gameplays/match3_gameplay.tscn`)
1. **Match3 Controller** (`scenes/game/gameplays/match3_gameplay.gd`)
#### Match-3 Mode (`scenes/game/gameplays/Match3Gameplay.tscn`)
1. **Match3 Controller** (`scenes/game/gameplays/Match3Gameplay.gd`)
- Grid management (8x8 default) with memory-safe node cleanup
- Match detection algorithms with bounds checking and validation
- Tile dropping and refilling with signal connections
@@ -178,7 +180,7 @@ The game now uses a modular gameplay architecture where different game modes can
- Smooth animations with Tween system
- **Memory Safety**: Resource management and cleanup
#### Clickomania Mode (`scenes/game/gameplays/clickomania_gameplay.tscn`)
#### Clickomania Mode (`scenes/game/gameplays/ClickomaniaGameplay.tscn`)
- Planned implementation for clickomania-style gameplay
- Will integrate with same scoring and UI systems as match-3
@@ -262,9 +264,9 @@ sprites:
- `MainStrings.ru.translation` - Russian translations
### Testing & Validation (`tests/`)
- `test_logging.gd` - DebugManager logging system validation
- `TestLogging.gd` - DebugManager logging system validation
- **`test_checksum_issue.gd`** - SaveManager checksum validation and deterministic hashing
- **`test_migration_compatibility.gd`** - SaveManager version migration and backward compatibility
- **`TestMigrationCompatibility.gd`** - SaveManager version migration and backward compatibility
- **`test_save_system_integration.gd`** - Complete save/load workflow integration testing
- **`test_checksum_fix_verification.gd`** - JSON serialization checksum fix verification
- `README.md` - Brief directory overview (see docs/TESTING.md for full guidelines)
@@ -296,7 +298,7 @@ GameManager --> main.tscn, game.tscn
GameManager --> scenes/game/gameplays/*.tscn (via GAMEPLAY_SCENES constant)
Main --> MainMenu.tscn, SettingsMenu.tscn
Game --> GameplayContainer (dynamic loading of gameplay scenes)
Game --> scenes/game/gameplays/match3_gameplay.tscn, clickomania_gameplay.tscn
Game --> scenes/game/gameplays/Match3Gameplay.tscn, ClickomaniaGameplay.tscn
```
### Asset Dependencies

View File

@@ -11,9 +11,11 @@ The `tests/` directory contains:
- Performance benchmarks
- Debugging tools
> 📋 **File Naming**: All test files follow the [naming conventions](CODE_OF_CONDUCT.md#2-file-naming-standards) with PascalCase and "Test" prefix (e.g., `TestAudioManager.gd`).
## Current Test Files
### `test_logging.gd`
### `TestLogging.gd`
Test script for DebugManager logging system.
**Features:**
@@ -26,10 +28,10 @@ Test script for DebugManager logging system.
**Usage:**
```gdscript
# Option 1: Add as temporary autoload
# In project.godot, add: tests/test_logging.gd
# In project.godot, add: tests/TestLogging.gd
# Option 2: Instantiate in a scene
var test_script = preload("res://tests/test_logging.gd").new()
var test_script = preload("res://tests/TestLogging.gd").new()
add_child(test_script)
# Option 3: Run directly from editor
@@ -49,7 +51,7 @@ Follow these conventions for new test files:
### File Naming
- Use descriptive names starting with `test_`
- Example: `test_audio_manager.gd`, `test_scene_transitions.gd`
- Example: `TestAudioManager.gd`, `test_scene_transitions.gd`
### File Structure
```gdscript
@@ -104,20 +106,20 @@ func test_error_conditions():
### System Tests
Test core autoload managers and global systems:
- `test_logging.gd` - DebugManager logging system
- `TestLogging.gd` - DebugManager logging system
- `test_checksum_issue.gd` - SaveManager checksum validation and deterministic hashing
- `test_migration_compatibility.gd` - SaveManager version migration and backward compatibility
- `TestMigrationCompatibility.gd` - SaveManager version migration and backward compatibility
- `test_save_system_integration.gd` - Complete save/load workflow integration testing
- `test_checksum_fix_verification.gd` - Verification of JSON serialization checksum fixes
- `test_settings_manager.gd` - SettingsManager security validation, input validation, and error handling
- `test_game_manager.gd` - GameManager scene transitions, race condition protection, and input validation
- `test_audio_manager.gd` - AudioManager functionality, resource loading, and volume management
- `TestSettingsManager.gd` - SettingsManager security validation, input validation, and error handling
- `TestGameManager.gd` - GameManager scene transitions, race condition protection, and input validation
- `TestAudioManager.gd` - AudioManager functionality, resource loading, and volume management
### Component Tests
Test individual game components:
- `test_match3_gameplay.gd` - Match-3 gameplay mechanics, grid management, and match detection
- `test_tile.gd` - Tile component behavior, visual feedback, and memory safety
- `test_value_stepper.gd` - ValueStepper UI component functionality and settings integration
- `TestMatch3Gameplay.gd` - Match-3 gameplay mechanics, grid management, and match detection
- `TestTile.gd` - Tile component behavior, visual feedback, and memory safety
- `TestValueStepper.gd` - ValueStepper UI component functionality and settings integration
### Integration Tests
Test system interactions and workflows:
@@ -135,7 +137,7 @@ SaveManager implements security features requiring testing for modifications.
**Tests**: Checksum generation, JSON serialization consistency, save/load cycles
**Usage**: Run after checksum algorithm changes
#### **`test_migration_compatibility.gd`** - Version Migration
#### **`TestMigrationCompatibility.gd`** - Version Migration
**Tests**: Backward compatibility, missing field addition, data structure normalization
**Usage**: Test save format upgrades
@@ -164,7 +166,7 @@ SaveManager implements security features requiring testing for modifications.
#### **Test Sequence After Modifications**
1. `test_checksum_issue.gd` - Verify checksum consistency
2. `test_migration_compatibility.gd` - Check version upgrades
2. `TestMigrationCompatibility.gd` - Check version upgrades
3. `test_save_system_integration.gd` - Validate workflow
4. Manual testing with corrupted files
5. Performance validation
@@ -182,7 +184,7 @@ godot --headless --script tests/test_checksum_issue.gd
# Run all save system tests
godot --headless --script tests/test_checksum_issue.gd
godot --headless --script tests/test_migration_compatibility.gd
godot --headless --script tests/TestMigrationCompatibility.gd
godot --headless --script tests/test_save_system_integration.gd
```
@@ -200,7 +202,7 @@ For CI/CD integration:
- name: Run Test Suite
run: |
godot --headless --script tests/test_checksum_issue.gd
godot --headless --script tests/test_migration_compatibility.gd
godot --headless --script tests/TestMigrationCompatibility.gd
# Add other tests as needed
```