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>
This commit is contained in:
@ -0,0 +1,4 @@
|
||||
{"diagnostics":[
|
||||
{"file":"ng.hako","line":1,"rule":"HC011","message":"[HC011] unreachable method (dead code): PLACEHOLDER :: Main.run/0","quickFix":"Remove or reference the dead method from an entrypoint","severity":"error"},
|
||||
{"file":"ng.hako","line":1,"rule":"HC014","message":"[HC014] missing entrypoint (Main.main or main)","quickFix":"","severity":"warning"}
|
||||
]}
|
||||
Reference in New Issue
Block a user