Skip to main content

refactoring_difficulty

Function refactoring_difficulty 

Source
pub fn refactoring_difficulty(facts: &GroupFacts) -> f64
Expand description

What removing the duplication would cost.

The extent is the bulk of it, but three other things change the answer: a run inside a unit has no boundary to lift it out at and has to be given one, everything the copies do differently becomes a parameter of whatever replaces them, and copies in different languages cannot share code at all without an interface between them. When the structural analysis measured raw identifiers or call surfaces, disagreement there is a separate fact: it says that a shared body may need a dispatcher rather than one ordinary abstraction. Missing measurements do not change the answer.

Higher is harder. It lowers a finding’s place in the report rather than raising it — a duplication nobody can act on is worth less attention than one anybody can — but only within the band its confidence puts it in.