## 実装内容
### HC012: Dead Static Box
- 未参照static boxを検出
- IR boxes配列活用、calls情報から参照チェック
- テスト: HC012_dead_static_box/{ok,ng}.hako + expected.json
### HC013: Duplicate Method
- 同名・同arityメソッド重複検出
- Box内でメソッド署名の一意性チェック
- テスト: HC013_duplicate_method/{ok,ng}.hako + expected.json
### 🔥 Critical Bug Fix: parser_core.hako arity計算修正
- **問題**: arityが「カンマの数」を返していた(add(a,b) → 1)
- **修正**: `if any == 1 { arity = arity + 1 }` に変更
- **影響**: 全メソッドのarity計算が正しくなった(HC015等に波及)
### Infrastructure改善
- analysis_consumer.hako: _ensure_array()ヘルパー導入
- MapBox.get().push()問題の根本解決
- uses/methods/calls/boxes全てで安全なpush実現
- run_tests.sh: NYASH_JSON_ONLY=1で出力純度確保
- cli.hako: HC012/HC013統合、デバッグ出力追加
## テスト結果
✅ HC011_dead_methods: OK
✅ HC012_dead_static_box: OK
✅ HC013_duplicate_method: OK
✅ HC016_unused_alias: OK
[TEST/SUMMARY] all green
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
1.3 KiB
1.3 KiB
Hako Check — Diagnostics Contract (MVP)
This tool lints .hako sources and emits diagnostics.
Diagnostics schema (typed)
- Map fields:
rule: string like "HC011"message: string (human-readable, one line)file: string (path)line: int (1-based)severity: string ("error"|"warning"|"info"), optional (default: warning)quickFix: string, optional
Backwards compatibility
- Rules may still
out.push("[HCxxx] ...")with a single-line string. - The CLI accepts both forms. String diagnostics are converted to typed internally.
Suppression policy
- HC012 (dead static box) takes precedence over HC011 (unreachable method).
- If a box is reported by HC012, HC011 diagnostics for methods in that box are suppressed at aggregation.
Quiet / JSON output
- When
--format json-lspis used, output is pure JSON (pretty). Combine withNYASH_JSON_ONLY=1in the runner to avoid extra lines. - Non-JSON formats print human-readable lines per finding.
Planned AST metadata (parser_core.hako)
boxes[].span_line: starting line of thestatic boxdeclaration.methods[].arity: parameter count as an integer.boxes[].is_static: boolean.
Notes
- Prefer AST intake; text scans are a minimal fallback.
- For tests, use
tools/hako_check/run_tests.sh.