# Global Metrics

path: .metrics.nexits.average
old: 0.75
new: 0.3333333333333333
path: .metrics.nexits.sum
old: 3.0
new: 2.0
path: .metrics.nom.functions
old: 4.0
new: 6.0
path: .metrics.nom.total
old: 4.0
new: 6.0
path: .metrics.cyclomatic.average
old: 12.4
new: 1.0
path: .metrics.cyclomatic.sum
old: 62.0
new: 11.0
path: .metrics.cognitive.sum
old: 37.0
new: 0.0
path: .metrics.cognitive.average
old: 9.25
new: 0.0
path: .metrics.halstead.vocabulary
old: 184.0
new: 93.0
path: .metrics.halstead.n1
old: 34.0
new: 15.0
path: .metrics.halstead.estimated_program_length
old: 1257.2965401768936
new: 548.8647320053832
path: .metrics.halstead.difficulty
old: 41.70666666666666
new: 15.096153846153848
path: .metrics.halstead.length
old: 939.0
new: 352.0
path: .metrics.halstead.purity_ratio
old: 1.3389739512000998
new: 1.559274806833475
path: .metrics.halstead.volume
old: 7064.624676737535
new: 2301.783901510027
path: .metrics.halstead.N1
old: 571.0
new: 195.0
path: .metrics.halstead.bugs
old: 1.4759618378066812
new: 0.35494902391502653
path: .metrics.halstead.time
old: 16368.997028766673
new: 1930.449105433089
path: .metrics.halstead.N2
old: 368.0
new: 157.0
path: .metrics.halstead.level
old: 0.023976982097186704
new: 0.06624203821656051
path: .metrics.halstead.n2
old: 150.0
new: 78.0
path: .metrics.halstead.effort
old: 294641.9465178001
new: 34748.0838977956
path: .metrics.nargs.average
old: 1.5
new: 1.0
path: .metrics.loc.blank
old: 45.0
new: 32.0
path: .metrics.loc.cloc
old: 55.0
new: 31.0
path: .metrics.loc.sloc
old: 299.0
new: 145.0
path: .metrics.loc.lloc
old: 106.0
new: 3.0
path: .metrics.loc.ploc
old: 199.0
new: 82.0
path: .metrics.mi.mi_original
old: 18.305967230213028
new: 47.59142687745907
path: .metrics.mi.mi_sei
old: -12.147439303746769
new: 26.909473653673935
path: .metrics.mi.mi_visual_studio
old: 10.705243994276625
new: 27.83124378798776

# Spaces Data

## Minimal test - lines (39, 44)

path: .spaces[1].metrics.mi.mi_visual_studio
old: 20.200729993327283
new: 69.33908596675413
path: .spaces[1].metrics.mi.mi_original
old: 34.54324828858965
new: 118.56983700314956
path: .spaces[1].metrics.mi.mi_sei
old: 12.160510315438032
new: 95.5629035702528
path: .spaces[1].metrics.halstead.estimated_program_length
old: 750.7317846084998
new: 31.26112492884004
path: .spaces[1].metrics.halstead.effort
old: 213778.53499140943
new: 519.4610663544954
path: .spaces[1].metrics.halstead.length
old: 646.0
new: 23.0
path: .spaces[1].metrics.halstead.bugs
old: 1.1917581840099951
new: 0.02154008504983975
path: .spaces[1].metrics.halstead.time
old: 11876.585277300524
new: 28.858948130805302
path: .spaces[1].metrics.halstead.volume
old: 4484.864370449149
new: 82.45413751658658
path: .spaces[1].metrics.halstead.N2
old: 260.0
new: 9.0
path: .spaces[1].metrics.halstead.difficulty
old: 47.666666666666664
new: 6.3
path: .spaces[1].metrics.halstead.level
old: 0.02097902097902098
new: 0.15873015873015872
path: .spaces[1].metrics.halstead.N1
old: 386.0
new: 14.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.162123505585913
new: 1.3591793447321756
path: .spaces[1].metrics.halstead.n2
old: 90.0
new: 5.0
path: .spaces[1].metrics.halstead.vocabulary
old: 123.0
new: 12.0
path: .spaces[1].metrics.halstead.n1
old: 33.0
new: 7.0
path: .spaces[1].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[1].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[1].metrics.cyclomatic.sum
old: 30.0
new: 2.0
path: .spaces[1].metrics.cyclomatic.average
old: 30.0
new: 1.0
path: .spaces[1].metrics.loc.sloc
old: 200.0
new: 6.0
path: .spaces[1].metrics.loc.ploc
old: 121.0
new: 6.0
path: .spaces[1].metrics.loc.blank
old: 29.0
new: 0.0
path: .spaces[1].metrics.loc.cloc
old: 50.0
new: 0.0
path: .spaces[1].metrics.loc.lloc
old: 62.0
new: 0.0
path: .spaces[1].metrics.cognitive.sum
old: 28.0
new: 0.0
path: .spaces[1].metrics.cognitive.average
old: 28.0
new: 0.0

### Code

    class CategoryLeaf : public nsDepCharHashKey {
     public:
      explicit CategoryLeaf(const char* aKey)
          : nsDepCharHashKey(aKey), value(nullptr) {}
      const char* value;
    };

## Minimal test - lines (95, 143)

path: .spaces[3].metrics.cyclomatic.average
old: 28.0
new: 1.0
path: .spaces[3].metrics.cyclomatic.sum
old: 28.0
new: 2.0
path: .spaces[3].metrics.loc.ploc
old: 48.0
new: 34.0
path: .spaces[3].metrics.loc.lloc
old: 36.0
new: 1.0
path: .spaces[3].metrics.loc.cloc
old: 0.0
new: 6.0
path: .spaces[3].metrics.loc.sloc
old: 56.0
new: 49.0
path: .spaces[3].metrics.loc.blank
old: 8.0
new: 9.0
path: .spaces[3].metrics.nargs.sum
old: 2.0
new: 4.0
path: .spaces[3].metrics.nargs.average
old: 2.0
new: 4.0
path: .spaces[3].metrics.halstead.bugs
old: 0.2286430969828915
new: 0.15994044617484263
path: .spaces[3].metrics.halstead.volume
old: 1178.9308694566012
new: 966.7101860227506
path: .spaces[3].metrics.halstead.N1
old: 134.0
new: 90.0
path: .spaces[3].metrics.halstead.vocabulary
old: 62.0
new: 61.0
path: .spaces[3].metrics.halstead.length
old: 198.0
new: 163.0
path: .spaces[3].metrics.halstead.N2
old: 64.0
new: 73.0
path: .spaces[3].metrics.halstead.difficulty
old: 15.238095238095235
new: 10.872340425531917
path: .spaces[3].metrics.halstead.effort
old: 17964.660867910112
new: 10510.402235268628
path: .spaces[3].metrics.halstead.level
old: 0.065625
new: 0.09197651663405088
path: .spaces[3].metrics.halstead.n1
old: 20.0
new: 14.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.5803833012851274
new: 1.9286419934825485
path: .spaces[3].metrics.halstead.time
old: 998.0367148838952
new: 583.9112352927016
path: .spaces[3].metrics.halstead.estimated_program_length
old: 312.9158936544552
new: 314.3686449376554
path: .spaces[3].metrics.halstead.n2
old: 42.0
new: 47.0
path: .spaces[3].metrics.mi.mi_sei
old: 17.423880539898306
new: 53.81061977386603
path: .spaces[3].metrics.mi.mi_visual_studio
old: 36.59240563608141
new: 41.95803373670259
path: .spaces[3].metrics.mi.mi_original
old: 62.573013637699205
new: 71.74823768976142
path: .spaces[3].metrics.cognitive.average
old: 6.0
new: 0.0
path: .spaces[3].metrics.cognitive.sum
old: 6.0
new: 0.0

### Code

    class nsCategoryManager final : public nsICategoryManager,
                                    public nsIMemoryReporter {
     public:
      NS_DECL_ISUPPORTS
      NS_DECL_NSICATEGORYMANAGER
      NS_DECL_NSIMEMORYREPORTER

      /**
       * Suppress or unsuppress notifications of category changes to the
       * observer service. This is to be used by nsComponentManagerImpl
       * on startup while reading the stored category list.
       */
      nsresult SuppressNotifications(bool aSuppress);

      void AddCategoryEntry(const nsACString& aCategory, const nsACString& aKey,
                            const nsACString& aValue, bool aReplace,
                            nsACString& aOldValue);

      void AddCategoryEntry(const nsACString& aCategory, const nsACString& aKey,
                            const nsACString& aValue, bool aReplace = true) {
        nsCString oldValue;
        return AddCategoryEntry(aCategory, aKey, aValue, aReplace, oldValue);
      }

      static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
      void InitMemoryReporter();

      static nsCategoryManager* GetSingleton();
      static void Destroy();

     private:
      static nsCategoryManager* gCategoryManager;

      nsCategoryManager();
      ~nsCategoryManager();

      size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);

      CategoryNode* get_category(const nsACString& aName);
      void NotifyObservers(
          const char* aTopic,
          const nsACString& aCategoryName,  // must be a static string
          const nsACString& aEntryName);

      CategoryAllocator mArena;
      nsClassHashtable mTable;
      mozilla::Mutex mLock;
      bool mSuppressNotifications;
    };

## Minimal test - lines (19, 19)

path: .spaces[0].metrics.loc.sloc
old: 2.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 2.0
new: 1.0
path: .spaces[0].metrics.mi.mi_original
old: 137.27787253359645
new: null
path: .spaces[0].metrics.mi.mi_sei
old: 122.45107379539856
new: null
path: .spaces[0].metrics.mi.mi_visual_studio
old: 80.27945762198623
new: null
path: .spaces[0].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[0].metrics.nargs.average
old: 2.0
new: null
path: .spaces[0].metrics.halstead.purity_ratio
old: 2.0685773109898133
new: null
path: .spaces[0].metrics.halstead.N1
old: 10.0
new: 0.0
path: .spaces[0].metrics.halstead.N2
old: 9.0
new: 1.0
path: .spaces[0].metrics.halstead.vocabulary
old: 14.0
new: 1.0
path: .spaces[0].metrics.halstead.n1
old: 7.0
new: 0.0
path: .spaces[0].metrics.halstead.difficulty
old: 4.5
new: 0.0
path: .spaces[0].metrics.halstead.time
old: 18.08493587977362
new: 0.0
path: .spaces[0].metrics.halstead.volume
old: 72.33974351909448
new: 0.0
path: .spaces[0].metrics.halstead.bugs
old: 0.015773875094978646
new: 0.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 39.302968908806456
new: null
path: .spaces[0].metrics.halstead.length
old: 19.0
new: 1.0
path: .spaces[0].metrics.halstead.level
old: 0.2222222222222222
new: null
path: .spaces[0].metrics.halstead.effort
old: 325.52884583592515
new: 0.0
path: .spaces[0].metrics.halstead.n2
old: 7.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[0].metrics.nexits.average
old: 0.0
new: null

### Code

    class nsIMemoryReporter;

## Minimal test - lines (51, 88)

path: .spaces[2].metrics.cognitive.average
old: 3.0
new: 0.0
path: .spaces[2].metrics.cognitive.sum
old: 3.0
new: 0.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 0.25
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 10.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.lloc
old: 8.0
new: 2.0
path: .spaces[2].metrics.loc.sloc
old: 16.0
new: 38.0
path: .spaces[2].metrics.loc.ploc
old: 16.0
new: 27.0
path: .spaces[2].metrics.nargs.average
old: 1.0
new: 0.25
path: .spaces[2].metrics.nom.functions
old: 1.0
new: 4.0
path: .spaces[2].metrics.nom.total
old: 1.0
new: 4.0
path: .spaces[2].metrics.halstead.level
old: 0.11594202898550723
new: 0.06896551724137931
path: .spaces[2].metrics.halstead.N1
old: 38.0
new: 81.0
path: .spaces[2].metrics.halstead.n1
old: 12.0
new: 15.0
path: .spaces[2].metrics.halstead.vocabulary
old: 28.0
new: 45.0
path: .spaces[2].metrics.halstead.n2
old: 16.0
new: 30.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.7544188526008833
new: 1.4806480345495203
path: .spaces[2].metrics.halstead.length
old: 61.0
new: 139.0
path: .spaces[2].metrics.halstead.volume
old: 293.24865024551383
new: 763.3675803898248
path: .spaces[2].metrics.halstead.N2
old: 23.0
new: 58.0
path: .spaces[2].metrics.halstead.bugs
old: 0.061878839807806466
new: 0.16555662129889226
path: .spaces[2].metrics.halstead.effort
old: 2529.269608367557
new: 11068.82991565246
path: .spaces[2].metrics.halstead.estimated_program_length
old: 107.01955000865388
new: 205.81007680238335
path: .spaces[2].metrics.halstead.difficulty
old: 8.625
new: 14.5
path: .spaces[2].metrics.halstead.time
old: 140.51497824264206
new: 614.9349953140255
path: .spaces[2].metrics.mi.mi_original
old: 96.08275409886136
new: 76.40485791796351
path: .spaces[2].metrics.mi.mi_sei
old: 63.12090058017722
new: 47.4709215826703
path: .spaces[2].metrics.mi.mi_visual_studio
old: 56.188745087053434
new: 44.68120346079738
path: .spaces[2].metrics.cyclomatic.sum
old: 2.0
new: 5.0
path: .spaces[2].metrics.cyclomatic.average
old: 2.0
new: 1.0

### Code

    class CategoryNode {
     public:
      nsresult GetLeaf(const nsACString& aEntryName, nsACString& aResult);

      nsresult AddLeaf(const nsACString& aEntryName, const nsACString& aValue,
                       bool aReplace, nsACString& aResult,
                       CategoryAllocator* aArena);

      void DeleteLeaf(const nsACString& aEntryName);

      void Clear() {
        mozilla::MutexAutoLock lock(mLock);
        mTable.Clear();
      }

      uint32_t Count() {
        mozilla::MutexAutoLock lock(mLock);
        uint32_t tCount = mTable.Count();
        return tCount;
      }

      nsresult Enumerate(nsISimpleEnumerator** aResult);

      // CategoryNode is arena-allocated, with the strings
      static CategoryNode* Create(CategoryAllocator* aArena);
      ~CategoryNode();
      void operator delete(void*) {}

      size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf);

     private:
      CategoryNode() : mLock("CategoryLeaf") {}

      void* operator new(size_t aSize, CategoryAllocator* aArena);

      nsTHashtable mTable;
      mozilla::Mutex mLock;
    };