Skip to content

refactor: clean up cycles.rs code quality issues #64

@userFRM

Description

@userFRM

Problem

PR #61 (detect_cycles) introduced three code quality issues identified during post-merge review:

  1. Hand-rolled glob_match() — cycles.rs implements a naive glob matcher when globset is already a workspace dependency, and the ignore crate is used elsewhere for .rpgignore handling
  2. Inline TOON formatting — ~130 lines of TOON formatting live inside the detect_cycles tool handler in tools.rs instead of in toon.rs (where format_health_report() lives)
  3. Duplicated .rpgignore parsing — cycles.rs manually reads and parses .rpgignore instead of reusing the ignore::gitignore::Gitignore API that rpg-encoder/src/evolution.rs already uses

Solution

  1. Replace glob_match() with ignore::gitignore::Gitignore::matched_path_or_any_parents()
  2. Extract formatting to format_cycle_report() in toon.rs
  3. Move .rpgignore loading to the MCP layer, pass Option<Gitignore> via CycleConfig::excluded_paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions