Files
hakorune/tools/hako_check
nyash-codex 411c0a3e63 test: run_tests.sh now supports testing specific directories
 Enhancement:
- tools/hako_check/run_tests.sh: Added argument handling (lines 97-116)
- Previously: Always ran all tests regardless of arguments
- Now: Can run specific test directory when provided as argument
- Example: bash run_tests.sh tools/hako_check/tests/HC021_analyzer_io_safety

 Use cases:
- Faster iteration during rule development
- Targeted debugging of specific rule tests
- CI/CD pipeline optimization

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 04:17:57 +09:00
..

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-lsp is used, output is pure JSON (pretty). Combine with NYASH_JSON_ONLY=1 in 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 the static box declaration.
  • 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.