DocsConcepts
Similar functions
Some functions share almost the same structure. When one changes and the others don't, Whaatcher shows it, since the others may need the same change.
How similar functions are found
Whaatcher compares the parameters and body of each function on the analyzed branch (Code Analysis). It ignores comments and function names and turns identifiers, strings and numbers into placeholders, so a copy with renamed variables still matches.
Similarity is an estimate from 0 to 1; 0.80 or above counts as similar. Functions under 50 tokens, such as getters, and repetitive ones, such as mapping tables, are left out because they look alike by chance. Overview, Impact and Insight also leave out test code.
Groups and “never together”
Similar function groups join similar pairs, so two members of a group may not be directly similar. Each group shows how its members changed:
- always together: the members always changed in the same commits.
- ⚠ never together: no commit changed all of them, counting the commits that added them.
- ⚠ together 2× · each 3–7×: they changed together twice, and 3 to 7 times each.
If functions marked ⚠ were copied from each other, a bug fixed in one may remain in the others, or they may be meant to differ. Whaatcher doesn't decide; it shows how they changed.
Where you see them
- Overview: Similar function groups and the Similar functions changed apart card.
- Files: the Similar column in OUTLINE, and Similar Functions on a selected function.
- Impact: Similar Functions shows functions similar to a changed one that the commit left unchanged. Only commits on the analyzed branch have it.
- Insight: Similar functions left unchanged in the Code tab lists fixes that changed one side and left the similar function unchanged ever since.
Approximate, not certain
Similarity is a MinHash estimate, at times off by about 0.04, so the screens mark it approximate in italics (Recorded and inferred). Similar structure doesn't mean the same purpose: unrelated functions of one shape can match, and functions doing one job differently won't. Insight spots fixes only by commit titles such as fix: …, so those are candidates too.