feat: add local quality gate scripts and documentation
Add quality.sh (bash), quality.ps1 (PowerShell), and fix_format.sh for automated GDScript quality checking. Includes: - gdformat --check (formatting gate) - gdlint (lint rules) - godot --headless project validation (with 30s timeout) - Optional GUT test support - --changed mode for checking only modified .gd files - Compact summary output with NEXT FIX suggestions - Full logs saved to logs/quality/latest/ Add docs/local_quality_gate.md with setup and usage instructions.
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
# Local Quality Gate
|
||||
|
||||
A single command to detect broken GDScript, formatting issues, lint problems,
|
||||
parser errors, and LLM-generated garbage before committing.
|
||||
|
||||
## Requirements
|
||||
|
||||
- **Python 3** with `gdtoolkit` (gdscript-toolkit):
|
||||
```bash
|
||||
pip install gdtoolkit
|
||||
```
|
||||
- **Godot 4** binary on `PATH`, or set the `GODOT_BIN` environment variable
|
||||
|
||||
## Usage
|
||||
|
||||
### Full project check
|
||||
|
||||
```bash
|
||||
# Linux / macOS / Git Bash
|
||||
./tools/quality.sh
|
||||
|
||||
# Windows PowerShell
|
||||
pwsh ./tools/quality.ps1
|
||||
```
|
||||
|
||||
### Fast changed-files mode
|
||||
|
||||
Only runs `gdformat` / `gdlint` on `.gd` files modified since the last commit.
|
||||
The Godot parser check still runs on the whole project.
|
||||
|
||||
```bash
|
||||
./tools/quality.sh --changed
|
||||
pwsh ./tools/quality.ps1 -Changed
|
||||
```
|
||||
|
||||
### Auto-format (not part of the gate)
|
||||
|
||||
```bash
|
||||
./tools/fix_format.sh
|
||||
```
|
||||
|
||||
## What it checks
|
||||
|
||||
| Check | Tool | What it detects |
|
||||
|---|---|---|
|
||||
| **gdformat** | `gdformat --check .` | Unformatted code (indentation, spacing) |
|
||||
| **gdlint** | `gdlint .` | Lint violations (unused args, long lines, naming, etc.) |
|
||||
| **godot-check** | `godot --headless --check-only` | Parser/syntax errors, missing dependencies |
|
||||
| **gut** | `godot -s gut_cmdln.gd` | Failing GUT unit tests (only if addon exists) |
|
||||
|
||||
## Output
|
||||
|
||||
If everything passes:
|
||||
|
||||
```
|
||||
QUALITY RESULT: PASS
|
||||
|
||||
gdformat PASS
|
||||
gdlint PASS
|
||||
godot-check PASS
|
||||
gut SKIPPED
|
||||
|
||||
Full logs:
|
||||
logs/quality/latest/
|
||||
```
|
||||
|
||||
On failure, only relevant errors and fix suggestions are shown:
|
||||
|
||||
```
|
||||
QUALITY RESULT: FAIL
|
||||
|
||||
gdformat FAIL
|
||||
gdlint FAIL
|
||||
godot-check PASS
|
||||
gut SKIPPED
|
||||
|
||||
res://simulation/SimNPC.gd:42 Unused argument 'delta'
|
||||
res://simulation/task_manager.gd:88 Line too long (120 > 100)
|
||||
|
||||
NEXT FIX:
|
||||
1. Fix unused-argument in SimNPC.gd
|
||||
2. Run gdformat to auto-format files
|
||||
|
||||
Full logs:
|
||||
logs/quality/latest/
|
||||
```
|
||||
|
||||
Full logs are always written to `logs/quality/latest/` and never dumped
|
||||
to the terminal.
|
||||
|
||||
## Environment variables
|
||||
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `GODOT_BIN` | Path to the Godot executable (auto-detected from PATH if unset) |
|
||||
|
||||
## CI setup
|
||||
|
||||
To add this to CI, install the dependencies and run:
|
||||
|
||||
```bash
|
||||
pip install gdtoolkit
|
||||
./tools/quality.sh
|
||||
```
|
||||
|
||||
The script exits non-zero on any failure, so it will fail the CI step.
|
||||
Reference in New Issue
Block a user