scitools.com

← Metric catalog

Unique Modifies 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 Modifies

API ID: CountModifiesUnique
Languages: Any
Targets: Objects

The number of unique entities that modify this object

Example:

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

Compare to CountModifies which counts all modifications.