## 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>
15 lines
189 B
Plaintext
15 lines
189 B
Plaintext
// ok.hako — has Main.main entrypoint
|
|
|
|
static box Helper {
|
|
method calculate(x) {
|
|
return x * 2
|
|
}
|
|
}
|
|
|
|
static box Main {
|
|
method main() {
|
|
Helper.calculate(42)
|
|
return 0
|
|
}
|
|
}
|