Skip to main content

format_clones_text

Function format_clones_text 

Source
pub fn format_clones_text(report: &ClonesReport) -> String
Expand description

Format clone detection report as compact human-readable text

Output format:

Clone Detection: 8 pairs in 42 files (15234 tokens)

 #  Sim  Type  File A                          Lines    File B                          Lines
 1  92%  T2    auth/login.py                   45-62    auth/signup.py                  23-40
 2  85%  T3    core.py                         112-130  helpers.py                      88-106

Key design decisions for LLM-friendly output:

  • No ANSI color codes (wastes tokens, garbles non-terminal contexts)
  • One line per clone pair (compact table)
  • Common path prefix stripped from file paths
  • No configuration echo (user knows what they ran)
  • Compact type column: T1/T2/T3 instead of verbose descriptions