Skip to content

refactor: split evaluator/mod.rs into focused submodules #59

@unclesp1d3r

Description

@unclesp1d3r

Summary

src/evaluator/mod.rs is 2,638 lines -- 4.4x the project's 500-600 line guideline. It contains multiple responsibilities that should be separated into focused submodules.

Current State

The file contains:

  • EvaluationContext struct and methods (~200 lines)
  • MatchResult type and methods (~50 lines)
  • evaluate_single_rule() public function (~20 lines)
  • evaluate_rules() recursive hierarchical evaluation (~200 lines)
  • evaluate_rules_with_config() wrapper
  • ~2,000 lines of colocated #[cfg(test)] tests

Proposed Split

  1. evaluator/mod.rs -- Public API surface only: EvaluationContext, MatchResult, re-exports
  2. evaluator/engine.rs -- Core evaluation logic: evaluate_single_rule(), evaluate_rules(), evaluate_rules_with_config(), and the recursive hierarchy processing
  3. Move large test blocks to tests/evaluator_tests.rs or keep as #[cfg(test)] within each submodule

Why Before v0.2.0

v0.2.0 adds comparison operators (#34, #35), indirect offsets (#37), and relative offsets (#38). All of these will add evaluation logic to this module. Splitting now prevents the file from growing to 3,500+ lines.

Acceptance Criteria

  • evaluator/mod.rs is under 600 lines
  • No public API changes (all re-exports preserved)
  • All existing tests pass
  • cargo clippy -- -D warnings passes

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestevaluatorRule evaluation engine and logicpriority:normalStandard work itemsize:MThis PR changes 30-99 lines, ignoring generated files.

Type

No fields configured for Task.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions