scitools.com

← Metric catalog

Sets 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.

Sets

API ID: CountSets
Languages: Any
Targets: Objects

The number of times this object is set

Example:

    int a_global = 0;      // + 1 set reference
    void function1() {
      a_global += 1;
      if (a_global > 1)
        a_global = 0;      // + 1 set reference
    }
    void function2() {
      a_global -= 1;
      a_global -= 1;
      if (a_global < 0)
        a_global = 0;      // + 1 set reference
      if (a_global > 10)
        a_global = 10;     // + 1 set reference
    }
                           // CountSets = 4
    

Compare to CountSetsUnique which counts unique entities that set this object.