# Global Metrics

path: .metrics.loc.ploc
old: 334.0
new: 322.0
path: .metrics.loc.blank
old: 49.0
new: 64.0
path: .metrics.loc.sloc
old: 431.0
new: 423.0
path: .metrics.loc.cloc
old: 48.0
new: 37.0
path: .metrics.loc.lloc
old: 137.0
new: 101.0
path: .metrics.cognitive.sum
old: 67.0
new: 47.0
path: .metrics.cognitive.average
old: 8.375
new: 2.473684210526316
path: .metrics.mi.mi_original
old: 9.286067289740204
new: 11.088452658569594
path: .metrics.mi.mi_sei
old: -30.768387823345194
new: -31.376748949519666
path: .metrics.mi.mi_visual_studio
old: 5.43044870745041
new: 6.484475238929588
path: .metrics.nexits.average
old: 3.75
new: 1.3157894736842106
path: .metrics.nexits.sum
old: 30.0
new: 25.0
path: .metrics.nom.total
old: 8.0
new: 19.0
path: .metrics.nom.functions
old: 8.0
new: 19.0
path: .metrics.cyclomatic.sum
old: 67.0
new: 61.0
path: .metrics.cyclomatic.average
old: 6.7
new: 2.5416666666666665
path: .metrics.nargs.sum
old: 11.0
new: 18.0
path: .metrics.nargs.average
old: 1.375
new: 0.9473684210526316
path: .metrics.halstead.length
old: 1371.0
new: 1288.0
path: .metrics.halstead.estimated_program_length
old: 1238.7623024903896
new: 1593.2364407179073
path: .metrics.halstead.purity_ratio
old: 0.903546537192115
new: 1.2369848142219777
path: .metrics.halstead.time
old: 29555.25029071033
new: 27284.454085991325
path: .metrics.halstead.vocabulary
old: 180.0
new: 222.0
path: .metrics.halstead.volume
old: 10271.330595067984
new: 10039.207635858937
path: .metrics.halstead.bugs
old: 2.1885182694000376
new: 2.0749322834433395
path: .metrics.halstead.N2
old: 587.0
new: 541.0
path: .metrics.halstead.N1
old: 784.0
new: 747.0
path: .metrics.halstead.difficulty
old: 51.794117647058826
new: 48.92021276595744
path: .metrics.halstead.n1
old: 27.0
new: 34.0
path: .metrics.halstead.effort
old: 531994.505232786
new: 491120.1735478438
path: .metrics.halstead.n2
old: 153.0
new: 188.0
path: .metrics.halstead.level
old: 0.019307211811470753
new: 0.02044144829835816

# Spaces Data

## Minimal test - lines (69, 71)

path: .spaces[1].metrics.halstead.n1
old: 19.0
new: 7.0
path: .spaces[1].metrics.halstead.N1
old: 155.0
new: 10.0
path: .spaces[1].metrics.halstead.n2
old: 57.0
new: 6.0
path: .spaces[1].metrics.halstead.difficulty
old: 19.333333333333332
new: 5.25
path: .spaces[1].metrics.halstead.length
old: 271.0
new: 19.0
path: .spaces[1].metrics.halstead.volume
old: 1693.1883561432116
new: 70.30835464468075
path: .spaces[1].metrics.halstead.level
old: 0.05172413793103449
new: 0.1904761904761905
path: .spaces[1].metrics.halstead.N2
old: 116.0
new: 9.0
path: .spaces[1].metrics.halstead.vocabulary
old: 76.0
new: 13.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.5246692013388132
new: 1.850592603091061
path: .spaces[1].metrics.halstead.effort
old: 32734.974885435426
new: 369.1188618845739
path: .spaces[1].metrics.halstead.time
old: 1818.6097158575235
new: 20.506603438031885
path: .spaces[1].metrics.halstead.estimated_program_length
old: 413.1853535628184
new: 35.161259458730164
path: .spaces[1].metrics.halstead.bugs
old: 0.3411039537192685
new: 0.017152321325890632
path: .spaces[1].metrics.nexits.average
old: 10.0
new: 1.0
path: .spaces[1].metrics.nexits.sum
old: 10.0
new: 1.0
path: .spaces[1].metrics.mi.mi_original
old: 61.0052626805674
new: 130.8574496241963
path: .spaces[1].metrics.mi.mi_sei
old: 13.736615977032857
new: 113.18836150359706
path: .spaces[1].metrics.mi.mi_visual_studio
old: 35.67559221085813
new: 76.52482434163527
path: .spaces[1].metrics.cognitive.sum
old: 11.0
new: 0.0
path: .spaces[1].metrics.cognitive.average
old: 11.0
new: 0.0
path: .spaces[1].metrics.cyclomatic.sum
old: 14.0
new: 1.0
path: .spaces[1].metrics.cyclomatic.average
old: 14.0
new: 1.0
path: .spaces[1].metrics.loc.ploc
old: 60.0
new: 3.0
path: .spaces[1].metrics.loc.sloc
old: 67.0
new: 3.0
path: .spaces[1].metrics.loc.blank
old: 7.0
new: 0.0
path: .spaces[1].metrics.loc.lloc
old: 28.0
new: 1.0

### Code

    static NSFuncPtr GetSymbol(LibHandleType aLibHandle, const char* aSymbol) {
      return (NSFuncPtr)GetProcAddress(aLibHandle, aSymbol);
    }

## Minimal test - lines (48, 67)

path: .spaces[0].metrics.mi.mi_visual_studio
old: 44.75298742432712
new: 53.02908545152921
path: .spaces[0].metrics.mi.mi_original
old: 76.52760849559937
new: 90.67973612211496
path: .spaces[0].metrics.mi.mi_sei
old: 59.50425162703069
new: 72.30216378586206
path: .spaces[0].metrics.halstead.N2
old: 55.0
new: 36.0
path: .spaces[0].metrics.halstead.N1
old: 76.0
new: 44.0
path: .spaces[0].metrics.halstead.difficulty
old: 16.73913043478261
new: 7.92
path: .spaces[0].metrics.halstead.level
old: 0.05974025974025974
new: 0.12626262626262627
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.201106060290975
new: 1.9268769068672296
path: .spaces[0].metrics.halstead.time
old: 634.6347354963674
new: 181.98136005076935
path: .spaces[0].metrics.halstead.volume
old: 682.4383908973924
new: 413.594000115385
path: .spaces[0].metrics.halstead.effort
old: 11423.425238934611
new: 3275.664480913849
path: .spaces[0].metrics.halstead.vocabulary
old: 37.0
new: 36.0
path: .spaces[0].metrics.halstead.bugs
old: 0.1690737977009159
new: 0.0735210475376349
path: .spaces[0].metrics.halstead.estimated_program_length
old: 157.34489389811776
new: 154.1501525493784
path: .spaces[0].metrics.halstead.length
old: 131.0
new: 80.0
path: .spaces[0].metrics.halstead.n1
old: 14.0
new: 11.0
path: .spaces[0].metrics.halstead.n2
old: 23.0
new: 25.0
path: .spaces[0].metrics.nexits.sum
old: 5.0
new: 2.0
path: .spaces[0].metrics.nexits.average
old: 5.0
new: 2.0
path: .spaces[0].metrics.loc.cloc
old: 4.0
new: 1.0
path: .spaces[0].metrics.loc.lloc
old: 15.0
new: 6.0
path: .spaces[0].metrics.loc.blank
old: 4.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 30.0
new: 18.0
path: .spaces[0].metrics.loc.sloc
old: 38.0
new: 20.0
path: .spaces[0].metrics.cyclomatic.average
old: 7.0
new: 2.0
path: .spaces[0].metrics.cyclomatic.sum
old: 7.0
new: 2.0
path: .spaces[0].metrics.cognitive.average
old: 10.0
new: 1.0
path: .spaces[0].metrics.cognitive.sum
old: 10.0
new: 1.0

### Code

    static LibHandleResult GetLibHandle(pathstr_t aDependentLib) {
      LibHandleType libHandle =
          LoadLibraryExW(aDependentLib, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);

      if (!libHandle) {
        DWORD err = GetLastError();
    #  if defined(DEBUG)
        LPWSTR lpMsgBuf;
        FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
                           FORMAT_MESSAGE_IGNORE_INSERTS,
                       nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                       (LPWSTR)&lpMsgBuf, 0, nullptr);
        wprintf(L"Error loading %ls: %s\n", aDependentLib, lpMsgBuf);
        LocalFree(lpMsgBuf);
    #  endif  // defined(DEBUG)
        return Err(err);
      }

      return libHandle;
    }

## Minimal test - lines (107, 109)

path: .spaces[4].metrics.loc.lloc
old: 8.0
new: 1.0
path: .spaces[4].metrics.loc.ploc
old: 25.0
new: 3.0
path: .spaces[4].metrics.loc.blank
old: 1.0
new: 0.0
path: .spaces[4].metrics.loc.sloc
old: 26.0
new: 3.0
path: .spaces[4].metrics.mi.mi_original
old: 85.13239025284392
new: 130.8574496241963
path: .spaces[4].metrics.mi.mi_sei
old: 47.42468482300251
new: 113.18836150359706
path: .spaces[4].metrics.mi.mi_visual_studio
old: 49.78502353967481
new: 76.52482434163527
path: .spaces[4].metrics.nexits.average
old: 2.0
new: 1.0
path: .spaces[4].metrics.nexits.sum
old: 2.0
new: 1.0
path: .spaces[4].metrics.cyclomatic.average
old: 3.0
new: 1.0
path: .spaces[4].metrics.cyclomatic.sum
old: 3.0
new: 1.0
path: .spaces[4].metrics.halstead.N1
old: 63.0
new: 10.0
path: .spaces[4].metrics.halstead.N2
old: 36.0
new: 9.0
path: .spaces[4].metrics.halstead.time
old: 300.0630564912806
new: 20.506603438031885
path: .spaces[4].metrics.halstead.volume
old: 507.79901867755166
new: 70.30835464468075
path: .spaces[4].metrics.halstead.bugs
old: 0.1026129329747968
new: 0.017152321325890632
path: .spaces[4].metrics.halstead.difficulty
old: 10.636363636363637
new: 5.25
path: .spaces[4].metrics.halstead.estimated_program_length
old: 146.21321194585474
new: 35.161259458730164
path: .spaces[4].metrics.halstead.purity_ratio
old: 1.4769011307662094
new: 1.850592603091061
path: .spaces[4].metrics.halstead.n2
old: 22.0
new: 6.0
path: .spaces[4].metrics.halstead.n1
old: 13.0
new: 7.0
path: .spaces[4].metrics.halstead.length
old: 99.0
new: 19.0
path: .spaces[4].metrics.halstead.level
old: 0.09401709401709402
new: 0.1904761904761905
path: .spaces[4].metrics.halstead.effort
old: 5401.13501684305
new: 369.1188618845739
path: .spaces[4].metrics.halstead.vocabulary
old: 35.0
new: 13.0
path: .spaces[4].metrics.cognitive.average
old: 2.0
new: 0.0
path: .spaces[4].metrics.cognitive.sum
old: 2.0
new: 0.0

### Code

    static NSFuncPtr GetSymbol(LibHandleType aLibHandle, const char* aSymbol) {
      return (NSFuncPtr)dlsym(aLibHandle, aSymbol);
    }

## Minimal test - lines (73, 75)

path: .spaces[2].metrics.mi.mi_sei
old: 50.22070109521441
new: 119.57777639115298
path: .spaces[2].metrics.mi.mi_visual_studio
old: 45.46520322852135
new: 79.11476873621837
path: .spaces[2].metrics.mi.mi_original
old: 77.74549752077151
new: 135.2862545389334
path: .spaces[2].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[2].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[2].metrics.cognitive.average
old: 7.0
new: 0.0
path: .spaces[2].metrics.cognitive.sum
old: 7.0
new: 0.0
path: .spaces[2].metrics.halstead.difficulty
old: 18.36
new: 2.5
path: .spaces[2].metrics.halstead.n2
old: 25.0
new: 4.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.5541061363441442
new: 1.6
path: .spaces[2].metrics.halstead.N1
old: 72.0
new: 5.0
path: .spaces[2].metrics.halstead.n1
old: 18.0
new: 4.0
path: .spaces[2].metrics.halstead.level
old: 0.054466230936819175
new: 0.4
path: .spaces[2].metrics.halstead.vocabulary
old: 43.0
new: 8.0
path: .spaces[2].metrics.halstead.volume
old: 667.430564828358
new: 30.0
path: .spaces[2].metrics.halstead.bugs
old: 0.1771731570683446
new: 0.005928155507483437
path: .spaces[2].metrics.halstead.time
old: 680.7791761249251
new: 4.166666666666667
path: .spaces[2].metrics.halstead.effort
old: 12254.025170248651
new: 75.0
path: .spaces[2].metrics.halstead.N2
old: 51.0
new: 5.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 191.15505477032977
new: 16.0
path: .spaces[2].metrics.halstead.length
old: 123.0
new: 10.0
path: .spaces[2].metrics.nexits.average
old: 5.0
new: 0.0
path: .spaces[2].metrics.nexits.sum
old: 5.0
new: 0.0
path: .spaces[2].metrics.loc.blank
old: 6.0
new: 0.0
path: .spaces[2].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[2].metrics.loc.ploc
old: 28.0
new: 3.0
path: .spaces[2].metrics.loc.sloc
old: 35.0
new: 3.0
path: .spaces[2].metrics.loc.lloc
old: 15.0
new: 1.0
path: .spaces[2].metrics.cyclomatic.average
old: 8.0
new: 1.0
path: .spaces[2].metrics.cyclomatic.sum
old: 8.0
new: 1.0

### Code

    static void CloseLibHandle(LibHandleType aLibHandle) {
      FreeLibrary(aLibHandle);
    }

## Minimal test - lines (92, 105)

path: .spaces[3].metrics.halstead.effort
old: 22314.63967998517
new: 2769.8128291502817
path: .spaces[3].metrics.halstead.vocabulary
old: 50.0
new: 35.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.3876197305776996
new: 2.4256939131193405
path: .spaces[3].metrics.halstead.bugs
old: 0.26420355946931096
new: 0.0657424210663841
path: .spaces[3].metrics.halstead.time
old: 1239.7022044436203
new: 153.878490508349
path: .spaces[3].metrics.halstead.estimated_program_length
old: 233.1201147370535
new: 145.54163478716043
path: .spaces[3].metrics.halstead.difficulty
old: 23.53448275862069
new: 9.0
path: .spaces[3].metrics.halstead.n2
old: 29.0
new: 21.0
path: .spaces[3].metrics.halstead.N1
old: 103.0
new: 33.0
path: .spaces[3].metrics.halstead.level
old: 0.04249084249084249
new: 0.1111111111111111
path: .spaces[3].metrics.halstead.N2
old: 65.0
new: 27.0
path: .spaces[3].metrics.halstead.length
old: 168.0
new: 60.0
path: .spaces[3].metrics.halstead.n1
old: 21.0
new: 14.0
path: .spaces[3].metrics.halstead.volume
old: 948.1678398821535
new: 307.756981016698
path: .spaces[3].metrics.nexits.sum
old: 5.0
new: 2.0
path: .spaces[3].metrics.nexits.average
old: 1.25
new: 2.0
path: .spaces[3].metrics.cognitive.sum
old: 4.0
new: 1.0
path: .spaces[3].metrics.mi.mi_sei
old: 48.42355645552492
new: 65.87948184680468
path: .spaces[3].metrics.mi.mi_original
old: 70.34297965235064
new: 97.99485692616967
path: .spaces[3].metrics.mi.mi_visual_studio
old: 41.13624541073136
new: 57.30693387495303
path: .spaces[3].metrics.nom.functions
old: 4.0
new: 1.0
path: .spaces[3].metrics.nom.total
old: 4.0
new: 1.0
path: .spaces[3].metrics.loc.cloc
old: 4.0
new: 0.0
path: .spaces[3].metrics.loc.lloc
old: 16.0
new: 4.0
path: .spaces[3].metrics.loc.blank
old: 7.0
new: 0.0
path: .spaces[3].metrics.loc.sloc
old: 48.0
new: 14.0
path: .spaces[3].metrics.loc.ploc
old: 37.0
new: 14.0
path: .spaces[3].metrics.cyclomatic.sum
old: 10.0
new: 2.0
path: .spaces[3].metrics.nargs.sum
old: 4.0
new: 1.0

### Code

    static LibHandleResult GetLibHandle(pathstr_t aDependentLib) {
      LibHandleType libHandle = dlopen(aDependentLib, RTLD_GLOBAL | RTLD_LAZY
    #  ifdef XP_MACOSX
                                                          | RTLD_FIRST
    #  endif
      );
      if (!libHandle) {
        UniqueFreePtr errMsg(strdup(dlerror()));
        fprintf(stderr, "XPCOMGlueLoad error for file %s:\n%s\n", aDependentLib,
                errMsg.get());
        return Err(std::move(errMsg));
      }
      return libHandle;
    }