scitools.com

← Metric catalog

Unique Uses 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.

Unique Uses

API ID: CountUsesUnique
Languages: Any
Targets: Objects

The number of unique entities that use this object

Example:

    int a_global = 0;
    void function1() {
      a_global += 1;
      if (a_global > 1)    // + 1 use reference
        a_global = 0;
    }
    void function2() {
      a_global -= 1;
      a_global -= 1;
      if (a_global < 0)    // + 1 use reference
        a_global = 0;
      if (a_global > 10)   //     duplicate does not count
        a_global = 10;
    }
                           // CountUsesUnique = 2
    

Compare to CountUses which counts all uses.