# Global Metrics

path: .metrics.halstead.difficulty
old: 119.145
new: 29.547169811320753
path: .metrics.halstead.length
old: 4016.0
new: 580.0
path: .metrics.halstead.N2
old: 1833.0
new: 261.0
path: .metrics.halstead.n1
old: 26.0
new: 24.0
path: .metrics.halstead.effort
old: 3741848.6534674615
new: 120344.83466448083
path: .metrics.halstead.bugs
old: 8.034081327299912
new: 0.8125131185688016
path: .metrics.halstead.purity_ratio
old: 0.4111012626062284
new: 1.4193080486224257
path: .metrics.halstead.level
old: 0.008393134416047674
new: 0.03384418901660281
path: .metrics.halstead.volume
old: 31405.838713059395
new: 4072.973331556504
path: .metrics.halstead.N1
old: 2183.0
new: 319.0
path: .metrics.halstead.n2
old: 200.0
new: 106.0
path: .metrics.halstead.time
old: 207880.4807481923
new: 6685.824148026713
path: .metrics.halstead.vocabulary
old: 226.0
new: 130.0
path: .metrics.halstead.estimated_program_length
old: 1650.9826706266133
new: 823.1986682010069
path: .metrics.cognitive.average
old: 14.5
new: 0.16666666666666666
path: .metrics.cognitive.sum
old: 87.0
new: 1.0
path: .metrics.mi.mi_visual_studio
old: 2.8290548752373343
new: 60.514013355441634
path: .metrics.mi.mi_sei
old: -52.70160834746023
new: 118.85889561202204
path: .metrics.mi.mi_original
old: 4.837683836655842
new: 103.4789628378052
path: .metrics.loc.sloc
old: 633.0
new: 4.0
path: .metrics.loc.lloc
old: 132.0
new: 28.0
path: .metrics.loc.cloc
old: 17.0
new: 2.0
path: .metrics.loc.blank
old: 108.0
new: 0.0
path: .metrics.loc.ploc
old: 508.0
new: 108.0
path: .metrics.nom.functions
old: 6.0
new: 4.0
path: .metrics.nom.closures
old: 0.0
new: 2.0
path: .metrics.cyclomatic.sum
old: 34.0
new: 8.0
path: .metrics.cyclomatic.average
old: 4.857142857142857
new: 2.0
path: .metrics.nargs.sum
old: 47.0
new: 1.0
path: .metrics.nargs.average
old: 7.833333333333333
new: 0.16666666666666666
path: .metrics.nexits.average
old: 0.3333333333333333
new: 0.16666666666666666
path: .metrics.nexits.sum
old: 2.0
new: 1.0

# Spaces Data

## Minimal test - lines (79, 109)

path: .spaces[2].metrics.halstead.vocabulary
old: 101.0
new: 66.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 0.9522462854888364
new: 1.6409888126804806
path: .spaces[2].metrics.halstead.time
old: 8931.096387379319
new: 1247.7356432104234
path: .spaces[2].metrics.halstead.N1
old: 349.0
new: 108.0
path: .spaces[2].metrics.halstead.n2
old: 79.0
new: 49.0
path: .spaces[2].metrics.halstead.effort
old: 160759.73497282775
new: 22459.241577787623
path: .spaces[2].metrics.halstead.bugs
old: 0.9855158187694508
new: 0.26534371360109305
path: .spaces[2].metrics.halstead.n1
old: 22.0
new: 17.0
path: .spaces[2].metrics.halstead.N2
old: 277.0
new: 102.0
path: .spaces[2].metrics.halstead.level
old: 0.025927141450607153
new: 0.05651672433679355
path: .spaces[2].metrics.halstead.length
old: 626.0
new: 210.0
path: .spaces[2].metrics.halstead.difficulty
old: 38.56962025316456
new: 17.693877551020407
path: .spaces[2].metrics.halstead.volume
old: 4168.040388202623
new: 1269.3227650652752
path: .spaces[2].metrics.halstead.estimated_program_length
old: 596.1061747160117
new: 344.60765066290094
path: .spaces[2].metrics.mi.mi_original
old: 53.431029372465915
new: 77.74896562423194
path: .spaces[2].metrics.mi.mi_visual_studio
old: 31.246216007290013
new: 45.46723135919997
path: .spaces[2].metrics.mi.mi_sei
old: 9.977262659513784
new: 36.67083486712211
path: .spaces[2].metrics.loc.lloc
old: 21.0
new: 7.0
path: .spaces[2].metrics.loc.ploc
old: 75.0
new: 28.0
path: .spaces[2].metrics.loc.blank
old: 15.0
new: 3.0
path: .spaces[2].metrics.loc.sloc
old: 91.0
new: 31.0
path: .spaces[2].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[2].metrics.cognitive.sum
old: 12.0
new: 1.0
path: .spaces[2].metrics.cognitive.average
old: 12.0
new: 1.0
path: .spaces[2].metrics.cyclomatic.sum
old: 5.0
new: 2.0
path: .spaces[2].metrics.cyclomatic.average
old: 5.0
new: 2.0
path: .spaces[2].metrics.nargs.sum
old: 11.0
new: 1.0
path: .spaces[2].metrics.nargs.average
old: 11.0
new: 1.0
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 1.0

### Code

    static already_AddRefed MakeScreen(NSScreen* aScreen) {
      NS_OBJC_BEGIN_TRY_BLOCK_RETURN;

      DesktopToLayoutDeviceScale contentsScaleFactor(nsCocoaUtils::GetBackingScaleFactor(aScreen));
      CSSToLayoutDeviceScale defaultCssScaleFactor(contentsScaleFactor.scale);
      NSRect frame = [aScreen frame];
      LayoutDeviceIntRect rect =
          nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, contentsScaleFactor.scale);
      frame = [aScreen visibleFrame];
      LayoutDeviceIntRect availRect =
          nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, contentsScaleFactor.scale);
      NSWindowDepth depth = [aScreen depth];
      uint32_t pixelDepth = NSBitsPerPixelFromDepth(depth);
      float dpi = 96.0f;
      CGDirectDisplayID displayID =
          [[[aScreen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
      CGFloat heightMM = ::CGDisplayScreenSize(displayID).height;
      if (heightMM > 0) {
        dpi = rect.height / (heightMM / MM_PER_INCH_FLOAT);
      }
      MOZ_LOG(sScreenLog, LogLevel::Debug,
              ("New screen [%d %d %d %d (%d %d %d %d) %d %f %f %f]", rect.x, rect.y, rect.width,
               rect.height, availRect.x, availRect.y, availRect.width, availRect.height, pixelDepth,
               contentsScaleFactor.scale, defaultCssScaleFactor.scale, dpi));

      RefPtr screen = new Screen(rect, availRect, pixelDepth, pixelDepth, contentsScaleFactor,
                                         defaultCssScaleFactor, dpi);
      return screen.forget();

      NS_OBJC_END_TRY_BLOCK_RETURN(nullptr);
    }

## Minimal test - lines (59, 69)

path: .spaces[0].metrics.halstead.difficulty
old: 8.035714285714286
new: 4.0
path: .spaces[0].metrics.halstead.n2
old: 14.0
new: 12.0
path: .spaces[0].metrics.halstead.volume
old: 217.13097389073664
new: 129.65784284662087
path: .spaces[0].metrics.halstead.estimated_program_length
old: 81.83229392178727
new: 67.01955000865388
path: .spaces[0].metrics.halstead.N1
old: 23.0
new: 18.0
path: .spaces[0].metrics.halstead.length
old: 48.0
new: 30.0
path: .spaces[0].metrics.halstead.level
old: 0.12444444444444444
new: 0.25
path: .spaces[0].metrics.halstead.bugs
old: 0.04831065473253644
new: 0.021517142732338488
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.7048394567039014
new: 2.2339850002884627
path: .spaces[0].metrics.halstead.vocabulary
old: 23.0
new: 20.0
path: .spaces[0].metrics.halstead.effort
old: 1744.802468764848
new: 518.6313713864835
path: .spaces[0].metrics.halstead.N2
old: 25.0
new: 12.0
path: .spaces[0].metrics.halstead.time
old: 96.933470486936
new: 28.81285396591575
path: .spaces[0].metrics.halstead.n1
old: 9.0
new: 8.0
path: .spaces[0].metrics.mi.mi_original
old: 109.10444318830818
new: 106.6266217671008
path: .spaces[0].metrics.mi.mi_visual_studio
old: 63.803767946379054
new: 62.35474957140398
path: .spaces[0].metrics.mi.mi_sei
old: 81.80540699411554
new: 78.23066631753126
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 4.0
path: .spaces[0].metrics.loc.lloc
old: 1.0
new: 4.0
path: .spaces[0].metrics.loc.sloc
old: 8.0
new: 11.0
path: .spaces[0].metrics.loc.ploc
old: 8.0
new: 7.0
path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[0].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[0].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[0].metrics.nexits.average
old: 1.0
new: 0.0

### Code

    ScreenHelperCocoa::ScreenHelperCocoa() {
      NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;

      MOZ_LOG(sScreenLog, LogLevel::Debug, ("ScreenHelperCocoa created"));

      mDelegate = [[ScreenHelperDelegate alloc] initWithScreenHelper:this];

      RefreshScreens();

      NS_OBJC_END_TRY_IGNORE_BLOCK;
    }

## Minimal test - lines (71, 77)

path: .spaces[1].metrics.halstead.N1
old: 20.0
new: 8.0
path: .spaces[1].metrics.halstead.n1
old: 7.0
new: 6.0
path: .spaces[1].metrics.halstead.n2
old: 10.0
new: 5.0
path: .spaces[1].metrics.halstead.bugs
old: 0.02754225672917236
new: 0.008768493484667985
path: .spaces[1].metrics.halstead.difficulty
old: 5.25
new: 3.0
path: .spaces[1].metrics.halstead.time
old: 41.72618317109721
new: 7.495435173714144
path: .spaces[1].metrics.halstead.N2
old: 15.0
new: 5.0
path: .spaces[1].metrics.halstead.effort
old: 751.0712970797498
new: 134.9178331268546
path: .spaces[1].metrics.halstead.level
old: 0.1904761904761905
new: 0.3333333333333333
path: .spaces[1].metrics.halstead.estimated_program_length
old: 52.87076540327685
new: 27.11941547876375
path: .spaces[1].metrics.halstead.volume
old: 143.06119944376186
new: 44.97261104228487
path: .spaces[1].metrics.halstead.length
old: 35.0
new: 13.0
path: .spaces[1].metrics.halstead.vocabulary
old: 17.0
new: 11.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.5105932972364815
new: 2.0861088829818266
path: .spaces[1].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[1].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[1].metrics.mi.mi_original
old: 118.88808878296912
new: 119.4547765482761
path: .spaces[1].metrics.mi.mi_visual_studio
old: 69.5251981186954
new: 69.85659447267608
path: .spaces[1].metrics.mi.mi_sei
old: 95.92022397534808
new: 96.7377816040889
path: .spaces[1].metrics.loc.sloc
old: 5.0
new: 7.0
path: .spaces[1].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[1].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[1].metrics.nargs.average
old: 2.0
new: 0.0

### Code

    ScreenHelperCocoa::~ScreenHelperCocoa() {
      NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;

      [mDelegate release];

      NS_OBJC_END_TRY_IGNORE_BLOCK;
    }