Global Metrics

path: .metrics.loc.cloc
old: 40.0
new: 37.0

path: .metrics.loc.ploc
old: 427.0
new: 30.0

path: .metrics.loc.sloc
old: 504.0
new: 76.0

path: .metrics.loc.blank
old: 37.0
new: 9.0

path: .metrics.loc.lloc
old: 196.0
new: 4.0

path: .metrics.halstead.N2
old: 843.0
new: 45.0

path: .metrics.halstead.difficulty
old: 110.64375
new: 18.0

path: .metrics.halstead.N1
old: 1366.0
new: 70.0

path: .metrics.halstead.n2
old: 160.0
new: 20.0

path: .metrics.halstead.purity_ratio
old: 0.6328591339695273
new: 1.308161407806498

path: .metrics.halstead.time
old: 103986.6177760602
new: 594.5413751658659

path: .metrics.halstead.length
old: 2209.0
new: 115.0

path: .metrics.halstead.level
old: 0.009038016155453878
new: 0.05555555555555555

path: .metrics.halstead.vocabulary
old: 202.0
new: 36.0

path: .metrics.halstead.estimated_program_length
old: 1397.985826938686
new: 150.43856189774726

path: .metrics.halstead.volume
old: 16916.989165398714
new: 594.5413751658659

path: .metrics.halstead.bugs
old: 5.062659479313851
new: 0.1618757539616355

path: .metrics.halstead.effort
old: 1871759.119969084
new: 10701.744752985587

path: .metrics.halstead.n1
old: 42.0
new: 16.0

path: .metrics.mi.mi_original
old: -1.823318637253223
new: 65.32561027386632

path: .metrics.mi.mi_visual_studio
old: 0.0
new: 38.20211127126685

path: .metrics.mi.mi_sei
old: -47.72649618056306
new: 63.682192547647894

path: .metrics.nom.total
old: 33.0
new: 5.0

path: .metrics.nom.functions
old: 33.0
new: 5.0

path: .metrics.nargs.average
old: 1.5757575757575757
new: 0.6

path: .metrics.nargs.sum
old: 52.0
new: 3.0

path: .metrics.cognitive.average
old: 2.696969696969697
new: 0.0

path: .metrics.cognitive.sum
old: 89.0
new: 0.0

path: .metrics.cyclomatic.average
old: 2.657142857142857
new: 1.1111111111111112

path: .metrics.cyclomatic.sum
old: 93.0
new: 10.0

path: .metrics.nexits.sum
old: 46.0
new: 2.0

path: .metrics.nexits.average
old: 1.393939393939394
new: 0.4

Spaces Data

Minimal test - lines (38, 72)

path: .spaces[0].spaces[1].metrics.cognitive.average
old: 2.0
new: 0.0

path: .spaces[0].spaces[1].metrics.cognitive.sum
old: 2.0
new: 0.0

path: .spaces[0].spaces[1].metrics.nom.functions
old: 1.0
new: 4.0

path: .spaces[0].spaces[1].metrics.nom.total
old: 1.0
new: 4.0

path: .spaces[0].spaces[1].metrics.cyclomatic.average
old: 2.0
new: 1.2

path: .spaces[0].spaces[1].metrics.cyclomatic.sum
old: 2.0
new: 6.0

path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.06274509803921569
new: 0.07459207459207459

path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.08044174224296134
new: 0.10349205712181894

path: .spaces[0].spaces[1].metrics.halstead.N2
old: 17.0
new: 33.0

path: .spaces[0].spaces[1].metrics.halstead.effort
old: 3748.9019710822495
new: 5470.693848138037

path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.5885261333486111
new: 1.3345918611408831

path: .spaces[0].spaces[1].metrics.halstead.volume
old: 235.22522171496468
new: 408.070403590716

path: .spaces[0].spaces[1].metrics.halstead.N1
old: 35.0
new: 51.0

path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 23.0
new: 29.0

path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 15.9375
new: 13.40625

path: .spaces[0].spaces[1].metrics.halstead.length
old: 52.0
new: 84.0

path: .spaces[0].spaces[1].metrics.halstead.n1
old: 15.0
new: 13.0

path: .spaces[0].spaces[1].metrics.halstead.n2
old: 8.0
new: 16.0

path: .spaces[0].spaces[1].metrics.halstead.time
old: 208.27233172679163
new: 303.9274360076687

path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 82.60335893412778
new: 112.1057163358342

path: .spaces[0].spaces[1].metrics.nargs.sum
old: 1.0
new: 3.0

path: .spaces[0].spaces[1].metrics.nargs.average
old: 1.0
new: 0.75

path: .spaces[0].spaces[1].metrics.loc.cloc
old: 0.0
new: 14.0

path: .spaces[0].spaces[1].metrics.loc.ploc
old: 9.0
new: 17.0

path: .spaces[0].spaces[1].metrics.loc.sloc
old: 9.0
new: 35.0

path: .spaces[0].spaces[1].metrics.loc.blank
old: 0.0
new: 4.0

path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 78.2221404401664
new: 82.94689209192501

path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 62.31002101214758
new: 47.230336183457936

path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 106.55013593077236
new: 80.76387487371308

path: .spaces[0].spaces[1].metrics.nexits.average
old: 2.0
new: 0.5

Code

class ObserverList {
 public:
  /**
   * Note: When calling AddObserver, it's up to the caller to make sure the
   * object isn't going to be release as long as RemoveObserver hasn't been
   * called.
   *
   * @see RemoveObserver()
   */
  void AddObserver(Observer* aObserver) {
    mObservers.AppendElementUnlessExists(aObserver);
  }

  /**
   * Remove the observer from the observer list.
   * @return Whether the observer has been found in the list.
   */
  bool RemoveObserver(Observer* aObserver) {
    return mObservers.RemoveElement(aObserver);
  }

  uint32_t Length() { return mObservers.Length(); }

  /**
   * Call Notify() on each item in the list.
   */
  void Broadcast(const T& aParam) {
    for (Observer* obs : mObservers.ForwardRange()) {
      obs->Notify(aParam);
    }
  }

 protected:
  nsTObserverArray*> mObservers;
};

Minimal test - lines (23, 27)

path: .spaces[0].spaces[0].metrics.loc.ploc
old: 12.0
new: 5.0

path: .spaces[0].spaces[0].metrics.loc.lloc
old: 6.0
new: 0.0

path: .spaces[0].spaces[0].metrics.loc.sloc
old: 12.0
new: 5.0

path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 68.16946459666332
new: 101.2114517206299

path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 99.5821520127651
new: 122.48511222784056

path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 58.23517661565211
new: 71.62872060107637

path: .spaces[0].spaces[0].metrics.halstead.n1
old: 19.0
new: 9.0

path: .spaces[0].spaces[0].metrics.halstead.volume
old: 366.61052696862873
new: 68.53238859703687

path: .spaces[0].spaces[0].metrics.halstead.N2
old: 28.0
new: 6.0

path: .spaces[0].spaces[0].metrics.halstead.effort
old: 8126.533347804604
new: 370.0748984239991

path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.13473557905743924
new: 0.017181925476094106

path: .spaces[0].spaces[0].metrics.halstead.length
old: 74.0
new: 18.0

path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.6720293616767838
new: 2.229942527078757

path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 31.0
new: 14.0

path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 22.166666666666668
new: 5.4

path: .spaces[0].spaces[0].metrics.halstead.N1
old: 46.0
new: 12.0

path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 123.730172764082
new: 40.13896548741762

path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.045112781954887216
new: 0.18518518518518515

path: .spaces[0].spaces[0].metrics.halstead.n2
old: 12.0
new: 5.0

path: .spaces[0].spaces[0].metrics.halstead.time
old: 451.47407487803355
new: 20.55971657911106

path: .spaces[0].spaces[0].metrics.nexits.average
old: 1.0
new: 0.0

path: .spaces[0].spaces[0].metrics.nexits.sum
old: 1.0
new: 0.0

path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 2.0
new: 0.0

path: .spaces[0].spaces[0].metrics.cognitive.average
old: 2.0
new: 0.0

path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 2.0
new: 1.0

path: .spaces[0].spaces[0].metrics.nargs.average
old: 1.0
new: 0.0

path: .spaces[0].spaces[0].metrics.nargs.sum
old: 1.0
new: 0.0

Code

class Observer {
 public:
  virtual ~Observer() = default;
  virtual void Notify(const T& aParam) = 0;
};

Minimal test - lines (12, 74)

path: .spaces[0].metrics.cognitive.sum
old: 6.0
new: 0.0

path: .spaces[0].metrics.cognitive.average
old: 1.2
new: 0.0

path: .spaces[0].metrics.cyclomatic.average
old: 1.5
new: 1.125

path: .spaces[0].metrics.nargs.average
old: 0.8
new: 0.6

path: .spaces[0].metrics.nargs.sum
old: 4.0
new: 3.0

path: .spaces[0].metrics.mi.mi_visual_studio
old: 39.438520274536906
new: 40.24314106333685

path: .spaces[0].metrics.mi.mi_original
old: 67.4398696694581
new: 68.81577121830601

path: .spaces[0].metrics.mi.mi_sei
old: 47.40877497610839
new: 68.3327771208286

path: .spaces[0].metrics.loc.lloc
old: 16.0
new: 4.0

path: .spaces[0].metrics.loc.cloc
old: 6.0
new: 30.0

path: .spaces[0].metrics.loc.sloc
old: 53.0
new: 63.0

path: .spaces[0].metrics.loc.ploc
old: 40.0
new: 26.0

path: .spaces[0].metrics.nexits.average
old: 1.2
new: 0.4

path: .spaces[0].metrics.nexits.sum
old: 6.0
new: 2.0

path: .spaces[0].metrics.halstead.n1
old: 21.0
new: 16.0

path: .spaces[0].metrics.halstead.length
old: 229.0
new: 112.0

path: .spaces[0].metrics.halstead.time
old: 2425.770846106848
new: 590.8993877837431

path: .spaces[0].metrics.halstead.difficulty
old: 34.32692307692308
new: 18.666666666666668

path: .spaces[0].metrics.halstead.vocabulary
old: 47.0
new: 34.0

path: .spaces[0].metrics.halstead.N2
old: 85.0
new: 42.0

path: .spaces[0].metrics.halstead.n2
old: 26.0
new: 18.0

path: .spaces[0].metrics.halstead.effort
old: 43663.875229923266
new: 10636.188980107376

path: .spaces[0].metrics.halstead.bugs
old: 0.4133268295957737
new: 0.1612140080355414

path: .spaces[0].metrics.halstead.level
old: 0.029131652661064423
new: 0.05357142857142857

path: .spaces[0].metrics.halstead.purity_ratio
old: 0.9364633124455124
new: 1.2415950895175143

path: .spaces[0].metrics.halstead.N1
old: 144.0
new: 70.0

path: .spaces[0].metrics.halstead.volume
old: 1272.000847034179
new: 569.7958382200379

path: .spaces[0].metrics.halstead.estimated_program_length
old: 214.45009855002235
new: 139.0586500259616

Code

namespace mozilla {

/**
 * Observer provides a way for a class to observe something.
 * When an event has to be broadcasted to all Observer, Notify() method
 * is called.
 * T represents the type of the object passed in argument to Notify().
 *
 * @see ObserverList.
 */
template 
class Observer {
 public:
  virtual ~Observer() = default;
  virtual void Notify(const T& aParam) = 0;
};

/**
 * ObserverList tracks Observer and can notify them when Broadcast() is
 * called.
 * T represents the type of the object passed in argument to Broadcast() and
 * sent to Observer objects through Notify().
 *
 * @see Observer.
 */
template 
class ObserverList {
 public:
  /**
   * Note: When calling AddObserver, it's up to the caller to make sure the
   * object isn't going to be release as long as RemoveObserver hasn't been
   * called.
   *
   * @see RemoveObserver()
   */
  void AddObserver(Observer* aObserver) {
    mObservers.AppendElementUnlessExists(aObserver);
  }

  /**
   * Remove the observer from the observer list.
   * @return Whether the observer has been found in the list.
   */
  bool RemoveObserver(Observer* aObserver) {
    return mObservers.RemoveElement(aObserver);
  }

  uint32_t Length() { return mObservers.Length(); }

  /**
   * Call Notify() on each item in the list.
   */
  void Broadcast(const T& aParam) {
    for (Observer* obs : mObservers.ForwardRange()) {
      obs->Notify(aParam);
    }
  }

 protected:
  nsTObserverArray*> mObservers;
};

}  // namespace mozilla