# Global Metrics

path: .metrics.nargs.average
old: 2.875
new: 0.6
path: .metrics.nargs.sum
old: 23.0
new: 3.0
path: .metrics.cyclomatic.average
old: 3.4
new: 1.625
path: .metrics.cyclomatic.sum
old: 34.0
new: 13.0
path: .metrics.cognitive.average
old: 2.125
new: 1.0
path: .metrics.cognitive.sum
old: 17.0
new: 5.0
path: .metrics.nom.total
old: 8.0
new: 5.0
path: .metrics.nom.functions
old: 8.0
new: 5.0
path: .metrics.halstead.vocabulary
old: 167.0
new: 66.0
path: .metrics.halstead.effort
old: 368406.23382084654
new: 31892.86779616242
path: .metrics.halstead.difficulty
old: 53.65
new: 20.0625
path: .metrics.halstead.n1
old: 37.0
new: 18.0
path: .metrics.halstead.n2
old: 130.0
new: 48.0
path: .metrics.halstead.estimated_program_length
old: 1105.6575902219702
new: 343.1368500605771
path: .metrics.halstead.bugs
old: 1.7130237812525368
new: 0.3352286491600639
path: .metrics.halstead.length
old: 930.0
new: 263.0
path: .metrics.halstead.level
old: 0.018639328984156572
new: 0.04984423676012461
path: .metrics.halstead.purity_ratio
old: 1.1888791292709358
new: 1.3047028519413577
path: .metrics.halstead.time
old: 20467.01299004703
new: 1771.82598867569
path: .metrics.halstead.N1
old: 553.0
new: 156.0
path: .metrics.halstead.volume
old: 6866.844992000868
new: 1589.6756533912733
path: .metrics.halstead.N2
old: 377.0
new: 107.0
path: .metrics.loc.cloc
old: 75.0
new: 23.0
path: .metrics.loc.blank
old: 37.0
new: 11.0
path: .metrics.loc.lloc
old: 54.0
new: 17.0
path: .metrics.loc.sloc
old: 254.0
new: 88.0
path: .metrics.loc.ploc
old: 142.0
new: 54.0
path: .metrics.mi.mi_sei
old: 4.779906733794327
new: 43.65589139502939
path: .metrics.mi.mi_original
old: 27.535992689797354
new: 57.146460134750825
path: .metrics.mi.mi_visual_studio
old: 16.10291970163588
new: 33.418982534942
path: .metrics.nexits.sum
old: 10.0
new: 2.0
path: .metrics.nexits.average
old: 1.25
new: 0.4

# Spaces Data

## Minimal test - lines (23, 25)

path: .spaces[0].spaces[2].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[0].spaces[2].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[2].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[0].spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[0].spaces[2].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[2].metrics.halstead.length
old: 8.0
new: 15.0
path: .spaces[0].spaces[2].metrics.halstead.n2
old: 3.0
new: 4.0
path: .spaces[0].spaces[2].metrics.halstead.vocabulary
old: 8.0
new: 10.0
path: .spaces[0].spaces[2].metrics.halstead.volume
old: 24.0
new: 49.82892142331043
path: .spaces[0].spaces[2].metrics.halstead.bugs
old: 0.005108729549290353
new: 0.012302916570267969
path: .spaces[0].spaces[2].metrics.halstead.difficulty
old: 2.5
new: 4.5
path: .spaces[0].spaces[2].metrics.halstead.estimated_program_length
old: 16.36452797660028
new: 23.509775004326936
path: .spaces[0].spaces[2].metrics.halstead.level
old: 0.4
new: 0.2222222222222222
path: .spaces[0].spaces[2].metrics.halstead.purity_ratio
old: 2.045565997075035
new: 1.5673183336217955
path: .spaces[0].spaces[2].metrics.halstead.time
old: 3.3333333333333335
new: 12.457230355827608
path: .spaces[0].spaces[2].metrics.halstead.effort
old: 60.0
new: 224.23014640489697
path: .spaces[0].spaces[2].metrics.halstead.n1
old: 5.0
new: 6.0
path: .spaces[0].spaces[2].metrics.halstead.N1
old: 5.0
new: 9.0
path: .spaces[0].spaces[2].metrics.halstead.N2
old: 3.0
new: 6.0
path: .spaces[0].spaces[2].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[0].spaces[2].metrics.loc.ploc
old: 1.0
new: 3.0
path: .spaces[0].spaces[2].metrics.loc.sloc
old: 1.0
new: 3.0
path: .spaces[0].spaces[2].metrics.mi.mi_original
old: 154.24412008219068
new: 132.41778397553108
path: .spaces[0].spaces[2].metrics.mi.mi_sei
old: 146.92819499625
new: 115.54126799380094
path: .spaces[0].spaces[2].metrics.mi.mi_visual_studio
old: 90.2012398141466
new: 77.437300570486

### Code

      ~FormatEtc() {
        if (mFormat.ptd) CoTaskMemFree(mFormat.ptd);
      }

## Minimal test - lines (22, 22)

path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 90.2012398141466
new: 88.55729948050106
path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 146.92819499625
new: 142.8725801869061
path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 154.24412008219068
new: 151.43298211165683
path: .spaces[0].spaces[1].metrics.halstead.N1
old: 5.0
new: 7.0
path: .spaces[0].spaces[1].metrics.halstead.time
old: 3.3333333333333335
new: 8.585213545572929
path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.005108729549290353
new: 0.009599040339100903
path: .spaces[0].spaces[1].metrics.halstead.n2
old: 3.0
new: 4.0
path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 16.36452797660028
new: 19.60964047443681
path: .spaces[0].spaces[1].metrics.halstead.volume
old: 24.0
new: 41.209025018750054
path: .spaces[0].spaces[1].metrics.halstead.N2
old: 3.0
new: 6.0
path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 8.0
new: 9.0
path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 2.045565997075035
new: 1.5084338826489854
path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.4
new: 0.26666666666666666
path: .spaces[0].spaces[1].metrics.halstead.effort
old: 60.0
new: 154.5338438203127
path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 2.5
new: 3.75
path: .spaces[0].spaces[1].metrics.halstead.length
old: 8.0
new: 13.0
path: .spaces[0].spaces[1].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[0].spaces[1].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[1].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[1].metrics.nargs.average
old: 0.0
new: 1.0

### Code

      FormatEtc(const FormatEtc& copy) { CopyIn(©.mFormat); }

## Minimal test - lines (19, 50)

path: .spaces[0].metrics.loc.blank
old: 6.0
new: 3.0
path: .spaces[0].metrics.loc.lloc
old: 3.0
new: 17.0
path: .spaces[0].metrics.loc.cloc
old: 11.0
new: 0.0
path: .spaces[0].metrics.loc.sloc
old: 35.0
new: 32.0
path: .spaces[0].metrics.loc.ploc
old: 18.0
new: 29.0
path: .spaces[0].metrics.nom.total
old: 3.0
new: 5.0
path: .spaces[0].metrics.nom.functions
old: 3.0
new: 5.0
path: .spaces[0].metrics.nexits.average
old: 0.6666666666666666
new: 0.4
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 5.0
path: .spaces[0].metrics.cyclomatic.sum
old: 4.0
new: 11.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.8333333333333333
path: .spaces[0].metrics.nargs.average
old: 0.0
new: 0.6
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[0].metrics.halstead.effort
old: 3354.9504954936333
new: 24213.46932713884
path: .spaces[0].metrics.halstead.N1
old: 47.0
new: 100.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 141.1270456186744
new: 122.60335893412778
path: .spaces[0].metrics.halstead.level
old: 0.11827956989247312
new: 0.032327586206896554
path: .spaces[0].metrics.halstead.volume
old: 396.82210161752647
new: 782.7630170411262
path: .spaces[0].metrics.halstead.length
old: 78.0
new: 158.0
path: .spaces[0].metrics.halstead.vocabulary
old: 34.0
new: 31.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.809321097675313
new: 0.7759706261653657
path: .spaces[0].metrics.halstead.n1
old: 12.0
new: 16.0
path: .spaces[0].metrics.halstead.N2
old: 31.0
new: 58.0
path: .spaces[0].metrics.halstead.n2
old: 22.0
new: 15.0
path: .spaces[0].metrics.halstead.bugs
old: 0.07470267543563405
new: 0.278986652092794
path: .spaces[0].metrics.halstead.difficulty
old: 8.454545454545455
new: 30.933333333333337
path: .spaces[0].metrics.halstead.time
old: 186.3861386385352
new: 1345.1927403966022
path: .spaces[0].metrics.mi.mi_visual_studio
old: 47.584341182262534
new: 45.42594293970562
path: .spaces[0].metrics.mi.mi_original
old: 81.36922342166893
new: 77.67836242689661
path: .spaces[0].metrics.mi.mi_sei
old: 80.26532291314933
new: 37.48535471909564

### Code

    class FormatEtc {
     public:
      FormatEtc() { memset(&mFormat, 0, sizeof(FORMATETC)); }
      FormatEtc(const FormatEtc& copy) { CopyIn(©.mFormat); }
      ~FormatEtc() {
        if (mFormat.ptd) CoTaskMemFree(mFormat.ptd);
      }

      void CopyIn(const FORMATETC* aSrc) {
        if (!aSrc) {
          memset(&mFormat, 0, sizeof(FORMATETC));
          return;
        }
        mFormat = *aSrc;
        if (aSrc->ptd) {
          mFormat.ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE));
          *(mFormat.ptd) = *(aSrc->ptd);
        }
      }

      void CopyOut(LPFORMATETC aDest) {
        if (!aDest) return;
        *aDest = mFormat;
        if (mFormat.ptd) {
          aDest->ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE));
          *(aDest->ptd) = *(mFormat.ptd);
        }
      }

     private:
      FORMATETC mFormat;
    };

## Minimal test - lines (60, 86)

path: .spaces[1].metrics.nargs.average
old: 6.0
new: null
path: .spaces[1].metrics.nargs.sum
old: 6.0
new: 0.0
path: .spaces[1].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[1].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[1].metrics.cognitive.sum
old: 5.0
new: 0.0
path: .spaces[1].metrics.cognitive.average
old: 5.0
new: null
path: .spaces[1].metrics.loc.sloc
old: 43.0
new: 27.0
path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 7.0
path: .spaces[1].metrics.loc.lloc
old: 22.0
new: 0.0
path: .spaces[1].metrics.loc.blank
old: 5.0
new: 1.0
path: .spaces[1].metrics.loc.ploc
old: 38.0
new: 19.0
path: .spaces[1].metrics.halstead.effort
old: 24112.12424520685
new: 4053.6279768381937
path: .spaces[1].metrics.halstead.N2
old: 68.0
new: 45.0
path: .spaces[1].metrics.halstead.volume
old: 1063.7701872885375
new: 540.4837302450925
path: .spaces[1].metrics.halstead.vocabulary
old: 55.0
new: 44.0
path: .spaces[1].metrics.halstead.bugs
old: 0.2782076453106938
new: 0.08474381367192463
path: .spaces[1].metrics.halstead.N1
old: 116.0
new: 54.0
path: .spaces[1].metrics.halstead.level
old: 0.044117647058823525
new: 0.13333333333333333
path: .spaces[1].metrics.halstead.difficulty
old: 22.666666666666668
new: 7.5
path: .spaces[1].metrics.halstead.n1
old: 22.0
new: 11.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.4378940301567908
new: 2.0658459974125174
path: .spaces[1].metrics.halstead.time
old: 1339.5624580670474
new: 225.20155426878853
path: .spaces[1].metrics.halstead.length
old: 184.0
new: 99.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 264.5725015488495
new: 204.51875374383923
path: .spaces[1].metrics.nexits.average
old: 0.0
new: null
path: .spaces[1].metrics.cyclomatic.sum
old: 11.0
new: 1.0
path: .spaces[1].metrics.cyclomatic.average
old: 11.0
new: 1.0
path: .spaces[1].metrics.mi.mi_original
old: 71.29676990841764
new: 84.6566271870553
path: .spaces[1].metrics.mi.mi_sei
old: 28.278662839711927
new: 82.0104462454269
path: .spaces[1].metrics.mi.mi_visual_studio
old: 41.69401749030272
new: 49.506799524593745

### Code

    class CEnumFormatEtc final : public IEnumFORMATETC {
     public:
      explicit CEnumFormatEtc(nsTArray& aArray);
      CEnumFormatEtc();
      ~CEnumFormatEtc();

      // IUnknown impl.
      STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppv);
      STDMETHODIMP_(ULONG) AddRef();
      STDMETHODIMP_(ULONG) Release();

      // IEnumFORMATETC impl.
      STDMETHODIMP Next(ULONG aMaxToFetch, FORMATETC* aResult, ULONG* aNumFetched);
      STDMETHODIMP Skip(ULONG aSkipNum);
      STDMETHODIMP Reset();
      STDMETHODIMP Clone(LPENUMFORMATETC* aResult);  // Addrefs

      // Utils
      void AddFormatEtc(LPFORMATETC aFormat);

     private:
      nsTArray mFormatList;  // Formats
      ULONG mRefCnt;                    // Object reference count
      ULONG mCurrentIdx;                // Current element

      void SetIndex(uint32_t aIdx);
    };

## Minimal test - lines (21, 21)

path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 155.2836050228807
new: 150.59315950777284
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 148.4278547652622
new: 141.66097228105622
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 90.80912574437468
new: 88.06617515074434
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 5.0
new: 9.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 13.60964047443681
new: 27.11941547876375
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.944234353490973
new: 1.937101105625982
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 49.12871113600807
new: 145.2961279827665
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 2.5
new: 3.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.004471319041702271
new: 0.00921258354248177
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.4
new: 0.3333333333333333
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 5.0
new: 6.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 2.0
new: 5.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 7.0
new: 14.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 2.7293728408893374
new: 8.072007110153695
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 19.651484454403228
new: 48.43204266092216
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 2.0
new: 5.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 7.0
new: 11.0

### Code

      FormatEtc() { memset(&mFormat, 0, sizeof(FORMATETC)); }