Set/Modify to Use Ratio is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Set/Modify to Use Ratio
API ID: RatioSetModifyToUseLanguages: Any
Targets: Objects
The ratio of object sets and modifications to object uses
Example:
void ratio(int x, int y)
{
x += 1; // + 1 modify
if (x == 1); // + 1 use
if (x == 2); // + 1 use
if (x == 3); // + 1 use
// for x: 3 uses to 1 set/modify, RatioSetModifyToUse = 1 / 3 = 0.33
y = 1; // + 1 set
y += 2; // + 1 modify
if (y == 10); // + 1 use
// for y: 1 use to 2 set/modify, RatioSetModifyToUse = 2 / 1 = 2
}
Compare to RatioUseToSetModify for the opposite direction.