# Global Metrics

path: .metrics.cognitive.average
old: 1.0
new: 1.1428571428571428
path: .metrics.cognitive.sum
old: 1.0
new: 8.0
path: .metrics.cyclomatic.average
old: 1.5
new: 1.7272727272727273
path: .metrics.cyclomatic.sum
old: 6.0
new: 19.0
path: .metrics.mi.mi_sei
old: 70.12200477131533
new: 28.15159128876449
path: .metrics.mi.mi_original
old: 71.94979009038381
new: 50.08312025904432
path: .metrics.mi.mi_visual_studio
old: 42.07590063765135
new: 29.288374420493753
path: .metrics.halstead.N1
old: 36.0
new: 158.0
path: .metrics.halstead.n1
old: 11.0
new: 18.0
path: .metrics.halstead.n2
old: 23.0
new: 71.0
path: .metrics.halstead.N2
old: 34.0
new: 128.0
path: .metrics.halstead.time
old: 160.85721882117616
new: 1669.4623200057597
path: .metrics.halstead.effort
old: 2895.429938781171
new: 30050.32176010367
path: .metrics.halstead.bugs
old: 0.06771540065380008
new: 0.32218958414701826
path: .metrics.halstead.level
old: 0.12299465240641712
new: 0.06163194444444445
path: .metrics.halstead.length
old: 70.0
new: 286.0
path: .metrics.halstead.purity_ratio
old: 2.0299381827760223
new: 1.7891283059817975
path: .metrics.halstead.difficulty
old: 8.130434782608695
new: 16.225352112676056
path: .metrics.halstead.volume
old: 356.12239888752373
new: 1852.0597612563895
path: .metrics.halstead.estimated_program_length
old: 142.09567279432156
new: 511.69069551079406
path: .metrics.halstead.vocabulary
old: 34.0
new: 89.0
path: .metrics.loc.lloc
old: 11.0
new: 28.0
path: .metrics.loc.blank
old: 12.0
new: 25.0
path: .metrics.loc.cloc
old: 25.0
new: 20.0
path: .metrics.loc.sloc
old: 63.0
new: 119.0
path: .metrics.loc.ploc
old: 26.0
new: 74.0
path: .metrics.nexits.average
old: 0.0
new: 1.2857142857142858
path: .metrics.nexits.sum
old: 0.0
new: 9.0
path: .metrics.nom.total
old: 1.0
new: 7.0
path: .metrics.nom.functions
old: 1.0
new: 7.0

# Spaces Data

## Minimal test - lines (28, 81)

path: .spaces[0].metrics.halstead.N2
old: 27.0
new: 72.0
path: .spaces[0].metrics.halstead.effort
old: 2645.6005278417592
new: 14916.66840560771
path: .spaces[0].metrics.halstead.estimated_program_length
old: 107.54061610626604
new: 263.42124551085624
path: .spaces[0].metrics.halstead.difficulty
old: 8.735294117647058
new: 15.157894736842104
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.7069939064486674
new: 1.5404751199465276
path: .spaces[0].metrics.halstead.time
old: 146.97780710231996
new: 828.7038003115395
path: .spaces[0].metrics.halstead.level
old: 0.11447811447811448
new: 0.06597222222222222
path: .spaces[0].metrics.halstead.N1
old: 36.0
new: 99.0
path: .spaces[0].metrics.halstead.n1
old: 11.0
new: 16.0
path: .spaces[0].metrics.halstead.vocabulary
old: 28.0
new: 54.0
path: .spaces[0].metrics.halstead.n2
old: 17.0
new: 38.0
path: .spaces[0].metrics.halstead.volume
old: 302.86336008962905
new: 984.0857628699532
path: .spaces[0].metrics.halstead.length
old: 63.0
new: 171.0
path: .spaces[0].metrics.halstead.bugs
old: 0.06376195008518422
new: 0.20198849609199251
path: .spaces[0].metrics.loc.ploc
old: 17.0
new: 34.0
path: .spaces[0].metrics.loc.cloc
old: 20.0
new: 6.0
path: .spaces[0].metrics.loc.blank
old: 9.0
new: 14.0
path: .spaces[0].metrics.loc.sloc
old: 46.0
new: 54.0
path: .spaces[0].metrics.loc.lloc
old: 11.0
new: 14.0
path: .spaces[0].metrics.cognitive.average
old: 1.0
new: 1.6666666666666667
path: .spaces[0].metrics.cognitive.sum
old: 1.0
new: 5.0
path: .spaces[0].metrics.cyclomatic.sum
old: 5.0
new: 10.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.6666666666666667
new: 2.0
path: .spaces[0].metrics.mi.mi_original
old: 78.11694429248776
new: 68.24155058231808
path: .spaces[0].metrics.mi.mi_sei
old: 80.15198561942991
new: 48.45663545007211
path: .spaces[0].metrics.mi.mi_visual_studio
old: 45.68242356285834
new: 39.907339521823445
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 6.0
path: .spaces[0].metrics.nom.total
old: 1.0
new: 3.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 3.0

### Code

    namespace {

    // Used for signaling the background thread from the main thread.
    HANDLE sEventHandle = nullptr;

    // We need a runnable in order to find the hidden window on the main
    // thread.
    class HWNDGetter : public mozilla::Runnable {
     public:
      HWNDGetter() : Runnable("HWNDGetter"), hidden_window_hwnd(nullptr) {}

      HWND hidden_window_hwnd;

      NS_IMETHOD Run() override {
        // Jump through some hoops to locate the hidden window.
        nsCOMPtr appShell(
            do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
        nsCOMPtr hiddenWindow;

        nsresult rv = appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
        if (NS_FAILED(rv)) {
          return rv;
        }

        nsCOMPtr docShell;
        rv = hiddenWindow->GetDocShell(getter_AddRefs(docShell));
        if (NS_FAILED(rv) || !docShell) {
          return rv;
        }

        nsCOMPtr baseWindow(do_QueryInterface(docShell));

        if (!baseWindow) return NS_ERROR_FAILURE;

        nsCOMPtr widget;
        baseWindow->GetMainWidget(getter_AddRefs(widget));

        if (!widget) return NS_ERROR_FAILURE;

        hidden_window_hwnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW);

        return NS_OK;
      }
    };

    HWND GetHiddenWindowHWND() {
      // Need to dispatch this to the main thread because plenty of
      // the things it wants to access are main-thread-only.
      RefPtr getter = new HWNDGetter();
      NS_DispatchToMainThread(getter, NS_DISPATCH_SYNC);
      return getter->hidden_window_hwnd;
    }

    }  // namespace

## Minimal test - lines (37, 37)

path: .spaces[0].spaces[0].spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_sei
old: null
new: 144.12582230432585
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: null
new: 89.06530020579255
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_original
old: null
new: 152.30166335190526
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.length
old: 1.0
new: 11.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: null
new: 19.60964047443681
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.level
old: null
new: 0.5
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.7826945885851644
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N2
old: 1.0
new: 5.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.time
old: 0.0
new: 3.874352779540604
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.00564754704415116
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.effort
old: 0.0
new: 69.73835003173087
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 9.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.volume
old: 0.0
new: 34.86917501586544
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n1
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.difficulty
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N1
old: 0.0
new: 6.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n2
old: 1.0
new: 5.0
path: .spaces[0].spaces[0].spaces[0].metrics.nexits.average
old: null
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.nargs.average
old: null
new: 0.0

### Code

      HWNDGetter() : Runnable("HWNDGetter"), hidden_window_hwnd(nullptr) {}

## Minimal test - lines (35, 71)

path: .spaces[0].spaces[0].metrics.loc.lloc
old: 10.0
new: 12.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 12.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 34.0
new: 37.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 15.0
new: 26.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 7.0
new: 10.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 4.0
new: 8.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 2.0
new: 2.6666666666666665
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 1.0
new: 2.5
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 1.0
new: 5.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 0.0
new: 5.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.0
new: 2.5
path: .spaces[0].spaces[0].metrics.halstead.length
old: 60.0
new: 139.0
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.11188811188811187
new: 0.07111111111111111
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 285.2932501298081
new: 772.0878503831916
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 27.0
new: 47.0
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 34.0
new: 79.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 8.9375
new: 14.0625
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 2549.8084230351596
new: 10857.485396013632
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 11.0
new: 15.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 141.6560235019533
new: 603.1936331118684
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 26.0
new: 60.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 102.05374780501026
new: 218.60335893412775
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 16.0
new: 32.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.700895796750171
new: 1.5726860354973222
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.06221337752716842
new: 0.1634424691156756
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 85.04125482007478
new: 47.48229382622662
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 83.55466798595762
new: 76.08781845036847
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 48.86237893915651
new: 44.495800263373376

### Code

    class HWNDGetter : public mozilla::Runnable {
     public:
      HWNDGetter() : Runnable("HWNDGetter"), hidden_window_hwnd(nullptr) {}

      HWND hidden_window_hwnd;

      NS_IMETHOD Run() override {
        // Jump through some hoops to locate the hidden window.
        nsCOMPtr appShell(
            do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
        nsCOMPtr hiddenWindow;

        nsresult rv = appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
        if (NS_FAILED(rv)) {
          return rv;
        }

        nsCOMPtr docShell;
        rv = hiddenWindow->GetDocShell(getter_AddRefs(docShell));
        if (NS_FAILED(rv) || !docShell) {
          return rv;
        }

        nsCOMPtr baseWindow(do_QueryInterface(docShell));

        if (!baseWindow) return NS_ERROR_FAILURE;

        nsCOMPtr widget;
        baseWindow->GetMainWidget(getter_AddRefs(widget));

        if (!widget) return NS_ERROR_FAILURE;

        hidden_window_hwnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW);

        return NS_OK;
      }
    };