Files
hakorune/tools/hako_check/tests
nyash-codex 98545b2495 Implement HC014: Missing Entrypoint detection
## Overview
Detects when no valid entrypoint (Main.main or main) exists in analyzed code.

## Implementation Details
- **Rule**: `rule_missing_entrypoint.hako` following single-responsibility box principles
- **Detection**: Checks if any entrypoint from entrypoints[] exists in methods[]
- **Pattern Matching**: Matches "Main.main" or "main" with any arity (e.g., Main.main/0, Main.main/1)
- **Integration**: Added to cli.hako with debug output support

## Test Cases
- **ok.hako**: Main box with main() method → no warning
- **ng.hako**: Main box with run() method (not main) → HC014 + HC011 warnings
  - HC011: Main.run/0 unreachable (no entrypoint calling it)
  - HC014: Missing entrypoint (correct cascading diagnostics)

## Test Results
```
[TEST/OK] HC011_dead_methods
[TEST/OK] HC012_dead_static_box
[TEST/OK] HC013_duplicate_method
[TEST/OK] HC014_missing_entrypoint ← NEW
[TEST/OK] HC016_unused_alias
[TEST/SUMMARY] all green
```

## Architecture
- Box-first design: RuleMissingEntrypointBox with single responsibility
- Helper method: _has_entrypoint_method() for clean separation of concerns
- Diagnostic format: "[HC014] missing entrypoint (Main.main or main)"
- Severity: "warning" (non-blocking, informational)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 03:06:02 +09:00
..

Hako Check — Rule Tests (MVP)

構成1 ルール = 1 ディレクトリ)

  • tools/hako_check/tests/<rule_name>/
    • ok.hako … 検出なし
    • ng.hako … 最低 1 件の検出
    • edge.hako … 端境(任意)
    • expected.json … --format json-lsp の期待ダイアグノスティクス

実行MVP

  • bash tools/hako_check/run_tests.sh で全テストを走査
  • 差分があれば終了コード 1、詳細を提示

注意

  • 21.4 は AST JSON 優先。Text fallback の差異は expected に反映
  • ルール名は HCxxx を推奨(例: HC002