# Global Metrics

path: .metrics.cognitive.average
old: 3.8
new: 3.2333333333333334
path: .metrics.cognitive.sum
old: 57.0
new: 291.0
path: .metrics.nexits.sum
old: 18.0
new: 189.0
path: .metrics.nexits.average
old: 1.2
new: 2.1
path: .metrics.nargs.average
old: 3.1333333333333333
new: 2.5
path: .metrics.nargs.sum
old: 47.0
new: 225.0
path: .metrics.cyclomatic.average
old: 4.125
new: 9.0
path: .metrics.cyclomatic.sum
old: 66.0
new: 783.0
path: .metrics.halstead.length
old: 1074.0
new: 16841.0
path: .metrics.halstead.time
old: 35939.27782292478
new: 1103020.7066862632
path: .metrics.halstead.N1
old: 586.0
new: 9635.0
path: .metrics.halstead.purity_ratio
old: 0.5674566376530031
new: 0.8657365766238512
path: .metrics.halstead.vocabulary
old: 104.0
new: 1419.0
path: .metrics.halstead.estimated_program_length
old: 609.4484288393254
new: 14579.869686922277
path: .metrics.halstead.volume
old: 7196.272257283533
new: 176336.36609805375
path: .metrics.halstead.effort
old: 646907.000812646
new: 19854372.72035274
path: .metrics.halstead.n2
old: 76.0
new: 1376.0
path: .metrics.halstead.difficulty
old: 89.89473684210526
new: 112.59375
path: .metrics.halstead.level
old: 0.011124121779859483
new: 0.008881487649181239
path: .metrics.halstead.n1
old: 28.0
new: 43.0
path: .metrics.halstead.N2
old: 488.0
new: 7206.0
path: .metrics.halstead.bugs
old: 2.49329297093973
new: 24.4408436195894
path: .metrics.mi.mi_sei
old: -26.15729474086335
new: -266.4136933622661
path: .metrics.mi.mi_original
old: 10.957924080136692
new: -205.876835379589
path: .metrics.mi.mi_visual_studio
old: 6.408142736922042
new: 0.0
path: .metrics.nom.total
old: 15.0
new: 90.0
path: .metrics.nom.functions
old: 15.0
new: 84.0
path: .metrics.nom.closures
old: 0.0
new: 6.0
path: .metrics.loc.cloc
old: 60.0
new: 511.0
path: .metrics.loc.lloc
old: 125.0
new: 1442.0
path: .metrics.loc.ploc
old: 271.0
new: 2993.0
path: .metrics.loc.sloc
old: 442.0
new: 3904.0
path: .metrics.loc.blank
old: 111.0
new: 400.0

# Spaces Data

## Minimal test - lines (306, 317)

path: .spaces[4].metrics.halstead.vocabulary
old: 13.0
new: 38.0
path: .spaces[4].metrics.halstead.effort
old: 612.792817324165
new: 6612.388666938918
path: .spaces[4].metrics.halstead.difficulty
old: 7.2
new: 13.695652173913045
path: .spaces[4].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 162.64528392343908
path: .spaces[4].metrics.halstead.bugs
old: 0.02404849242411943
new: 0.11743142398041978
path: .spaces[4].metrics.halstead.N2
old: 9.0
new: 42.0
path: .spaces[4].metrics.halstead.length
old: 23.0
new: 92.0
path: .spaces[4].metrics.halstead.time
old: 34.04404540689805
new: 367.35492594105096
path: .spaces[4].metrics.halstead.N1
old: 14.0
new: 50.0
path: .spaces[4].metrics.halstead.n1
old: 8.0
new: 15.0
path: .spaces[4].metrics.halstead.n2
old: 5.0
new: 23.0
path: .spaces[4].metrics.halstead.volume
old: 85.11011351724513
new: 482.80933123680984
path: .spaces[4].metrics.halstead.purity_ratio
old: 1.5482452380189915
new: 1.7678835209069466
path: .spaces[4].metrics.halstead.level
old: 0.1388888888888889
new: 0.07301587301587302
path: .spaces[4].metrics.nargs.average
old: 2.0
new: 3.0
path: .spaces[4].metrics.nargs.sum
old: 2.0
new: 3.0
path: .spaces[4].metrics.loc.sloc
old: 6.0
new: 12.0
path: .spaces[4].metrics.loc.ploc
old: 6.0
new: 11.0
path: .spaces[4].metrics.loc.lloc
old: 2.0
new: 6.0
path: .spaces[4].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[4].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[4].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[4].metrics.mi.mi_sei
old: 95.32506240200723
new: 66.10399679327296
path: .spaces[4].metrics.mi.mi_visual_studio
old: 69.24267723272462
new: 57.39794083526768
path: .spaces[4].metrics.mi.mi_original
old: 118.40497806795908
new: 98.15047882830774

### Code

    static void InflateControlRect(NSRect* rect, NSControlSize cocoaControlSize,
                                   const float marginSet[][3][4]) {
      if (!marginSet) return;

      static int osIndex = yosemiteOSorlater;
      size_t controlSize = EnumSizeForCocoaSize(cocoaControlSize);
      const float* buttonMargins = marginSet[osIndex][controlSize];
      rect->origin.x -= buttonMargins[leftMargin];
      rect->origin.y -= buttonMargins[bottomMargin];
      rect->size.width += buttonMargins[leftMargin] + buttonMargins[rightMargin];
      rect->size.height += buttonMargins[bottomMargin] + buttonMargins[topMargin];
    }

## Minimal test - lines (138, 144)

path: .spaces[0].metrics.loc.lloc
old: 4.0
new: 0.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.blank
old: 2.0
new: 0.0
path: .spaces[0].metrics.loc.ploc
old: 11.0
new: 6.0
path: .spaces[0].metrics.loc.sloc
old: 13.0
new: 7.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 58.53654539024518
new: 69.04082094618934
path: .spaces[0].metrics.mi.mi_sei
old: 69.11658365003125
new: 122.3577385040131
path: .spaces[0].metrics.mi.mi_original
old: 100.09749261731926
new: 118.05980381798378
path: .spaces[0].metrics.halstead.volume
old: 236.83666567851097
new: 58.81033751683405
path: .spaces[0].metrics.halstead.estimated_program_length
old: 91.12526634448808
new: 27.651484454403228
path: .spaces[0].metrics.halstead.time
old: 151.8183754349429
new: 6.534481946314894
path: .spaces[0].metrics.halstead.N2
old: 25.0
new: 7.0
path: .spaces[0].metrics.halstead.n2
old: 13.0
new: 7.0
path: .spaces[0].metrics.halstead.vocabulary
old: 25.0
new: 11.0
path: .spaces[0].metrics.halstead.n1
old: 12.0
new: 4.0
path: .spaces[0].metrics.halstead.difficulty
old: 11.538461538461538
new: 2.0
path: .spaces[0].metrics.halstead.effort
old: 2732.7307578289724
new: 117.6206750336681
path: .spaces[0].metrics.halstead.level
old: 0.08666666666666667
new: 0.5
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.7867699283232954
new: 1.6265579090825428
path: .spaces[0].metrics.halstead.bugs
old: 0.06515433381222142
new: 0.008002048702810353
path: .spaces[0].metrics.halstead.length
old: 51.0
new: 17.0
path: .spaces[0].metrics.halstead.N1
old: 26.0
new: 10.0
path: .spaces[0].metrics.cognitive.average
old: 2.0
new: 0.0
path: .spaces[0].metrics.cognitive.sum
old: 2.0
new: 0.0
path: .spaces[0].metrics.nargs.sum
old: 3.0
new: 0.0
path: .spaces[0].metrics.nargs.average
old: 3.0
new: 0.0
path: .spaces[0].metrics.cyclomatic.average
old: 4.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.sum
old: 4.0
new: 1.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

    @interface NSProgressBarCell : NSCell {
      /*All instance variables are private*/
      double mValue;
      double mMax;
      bool mIsIndeterminate;
      bool mIsHorizontal;
    }

## Minimal test - lines (474, 480)

path: .spaces[8].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[8].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[8].metrics.cyclomatic.average
old: 4.0
new: 2.0
path: .spaces[8].metrics.cyclomatic.sum
old: 4.0
new: 2.0
path: .spaces[8].metrics.halstead.level
old: 0.06923076923076923
new: 0.1111111111111111
path: .spaces[8].metrics.halstead.N1
old: 28.0
new: 31.0
path: .spaces[8].metrics.halstead.effort
old: 3091.87258892186
new: 2745.0
path: .spaces[8].metrics.halstead.estimated_program_length
old: 76.63504134881501
new: 129.45811190640111
path: .spaces[8].metrics.halstead.n2
old: 9.0
new: 20.0
path: .spaces[8].metrics.halstead.n1
old: 13.0
new: 12.0
path: .spaces[8].metrics.halstead.difficulty
old: 14.444444444444445
new: 9.0
path: .spaces[8].metrics.halstead.N2
old: 20.0
new: 30.0
path: .spaces[8].metrics.halstead.vocabulary
old: 22.0
new: 32.0
path: .spaces[8].metrics.halstead.purity_ratio
old: 1.596563361433646
new: 2.122264129613133
path: .spaces[8].metrics.halstead.bugs
old: 0.07074457436147079
new: 0.06534920538525799
path: .spaces[8].metrics.halstead.length
old: 48.0
new: 61.0
path: .spaces[8].metrics.halstead.volume
old: 214.05271769459029
new: 305.0
path: .spaces[8].metrics.halstead.time
old: 171.77069938454778
new: 152.5
path: .spaces[8].metrics.nexits.average
old: 3.0
new: 1.0
path: .spaces[8].metrics.nexits.sum
old: 3.0
new: 1.0
path: .spaces[8].metrics.cognitive.sum
old: 4.0
new: 0.0
path: .spaces[8].metrics.cognitive.average
old: 4.0
new: 0.0
path: .spaces[8].metrics.loc.ploc
old: 15.0
new: 7.0
path: .spaces[8].metrics.loc.lloc
old: 8.0
new: 1.0
path: .spaces[8].metrics.loc.sloc
old: 20.0
new: 7.0
path: .spaces[8].metrics.loc.blank
old: 5.0
new: 0.0
path: .spaces[8].metrics.mi.mi_sei
old: 59.80728868218904
new: 82.14699001392553
path: .spaces[8].metrics.mi.mi_original
old: 93.64478105735856
new: 109.27063434694536
path: .spaces[8].metrics.mi.mi_visual_studio
old: 54.76302985810443
new: 63.90095575844759

### Code

    static int GetBackingScaleFactorForRendering(CGContextRef cgContext) {
      CGAffineTransform ctm = CGContextGetUserSpaceToDeviceSpaceTransform(cgContext);
      CGRect transformedUserSpacePixel = CGRectApplyAffineTransform(CGRectMake(0, 0, 1, 1), ctm);
      float maxScale = std::max(fabs(transformedUserSpacePixel.size.width),
                                fabs(transformedUserSpacePixel.size.height));
      return maxScale > 1.0 ? 2 : 1;
    }

## Minimal test - lines (507, 618)

path: .spaces[9].metrics.cognitive.sum
old: 4.0
new: 12.0
path: .spaces[9].metrics.cognitive.average
old: 4.0
new: 12.0
path: .spaces[9].metrics.halstead.vocabulary
old: 22.0
new: 106.0
path: .spaces[9].metrics.halstead.estimated_program_length
old: 76.10749561002054
new: 633.170197791106
path: .spaces[9].metrics.halstead.N1
old: 32.0
new: 350.0
path: .spaces[9].metrics.halstead.time
old: 208.10680886974055
new: 11309.228987707813
path: .spaces[9].metrics.halstead.n2
old: 11.0
new: 83.0
path: .spaces[9].metrics.halstead.volume
old: 267.56589711823784
new: 4534.618386375596
path: .spaces[9].metrics.halstead.difficulty
old: 14.0
new: 44.89156626506024
path: .spaces[9].metrics.halstead.bugs
old: 0.08039911628564245
new: 1.153495081803005
path: .spaces[9].metrics.halstead.effort
old: 3745.9225596553297
new: 203566.1217787406
path: .spaces[9].metrics.halstead.length
old: 60.0
new: 674.0
path: .spaces[9].metrics.halstead.n1
old: 11.0
new: 23.0
path: .spaces[9].metrics.halstead.level
old: 0.07142857142857142
new: 0.02227589908749329
path: .spaces[9].metrics.halstead.N2
old: 28.0
new: 324.0
path: .spaces[9].metrics.halstead.purity_ratio
old: 1.268458260167009
new: 0.9394216584437776
path: .spaces[9].metrics.loc.cloc
old: 0.0
new: 14.0
path: .spaces[9].metrics.loc.blank
old: 6.0
new: 25.0
path: .spaces[9].metrics.loc.ploc
old: 15.0
new: 73.0
path: .spaces[9].metrics.loc.sloc
old: 21.0
new: 112.0
path: .spaces[9].metrics.loc.lloc
old: 9.0
new: 38.0
path: .spaces[9].metrics.mi.mi_visual_studio
old: 53.62224206490051
new: 27.94674736291103
path: .spaces[9].metrics.mi.mi_original
old: 91.69403393097988
new: 47.788937990577864
path: .spaces[9].metrics.mi.mi_sei
old: 56.9929554769341
new: 20.604885004238163
path: .spaces[9].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[9].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[9].metrics.cyclomatic.sum
old: 4.0
new: 13.0
path: .spaces[9].metrics.cyclomatic.average
old: 4.0
new: 13.0
path: .spaces[9].metrics.nargs.average
old: 2.0
new: 9.0
path: .spaces[9].metrics.nargs.sum
old: 2.0
new: 9.0

### Code

    static void DrawCellWithScaling(NSCell* cell, CGContextRef cgContext, const HIRect& destRect,
                                    NSControlSize controlSize, NSSize naturalSize, NSSize minimumSize,
                                    const float marginSet[][3][4], NSView* view,
                                    BOOL mirrorHorizontal) {
      NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;

      NSRect drawRect =
          NSMakeRect(destRect.origin.x, destRect.origin.y, destRect.size.width, destRect.size.height);

      if (naturalSize.width != 0.0f) drawRect.size.width = naturalSize.width;
      if (naturalSize.height != 0.0f) drawRect.size.height = naturalSize.height;

      // Keep aspect ratio when scaling if one dimension is free.
      if (naturalSize.width == 0.0f && naturalSize.height != 0.0f)
        drawRect.size.width = destRect.size.width * naturalSize.height / destRect.size.height;
      if (naturalSize.height == 0.0f && naturalSize.width != 0.0f)
        drawRect.size.height = destRect.size.height * naturalSize.width / destRect.size.width;

      // Honor minimum sizes.
      if (drawRect.size.width < minimumSize.width) drawRect.size.width = minimumSize.width;
      if (drawRect.size.height < minimumSize.height) drawRect.size.height = minimumSize.height;

      [NSGraphicsContext saveGraphicsState];

      // Only skip the buffer if the area of our cell (in pixels^2) is too large.
      if (drawRect.size.width * drawRect.size.height > BITMAP_MAX_AREA) {
        // Inflate the rect Gecko gave us by the margin for the control.
        InflateControlRect(&drawRect, controlSize, marginSet);

        NSGraphicsContext* savedContext = [NSGraphicsContext currentContext];
        [NSGraphicsContext
            setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:cgContext
                                                                         flipped:YES]];

        DrawCellIncludingFocusRing(cell, drawRect, view);

        [NSGraphicsContext setCurrentContext:savedContext];
      } else {
        float w = ceil(drawRect.size.width);
        float h = ceil(drawRect.size.height);
        NSRect tmpRect = NSMakeRect(kMaxFocusRingWidth, kMaxFocusRingWidth, w, h);

        // inflate to figure out the frame we need to tell NSCell to draw in, to get something that's
        // 0,0,w,h
        InflateControlRect(&tmpRect, controlSize, marginSet);

        // and then, expand by kMaxFocusRingWidth size to make sure we can capture any focus ring
        w += kMaxFocusRingWidth * 2.0;
        h += kMaxFocusRingWidth * 2.0;

        int backingScaleFactor = GetBackingScaleFactorForRendering(cgContext);
        CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
        CGContextRef ctx = CGBitmapContextCreate(
            NULL, (int)w * backingScaleFactor, (int)h * backingScaleFactor, 8,
            (int)w * backingScaleFactor * 4, rgb, kCGImageAlphaPremultipliedFirst);
        CGColorSpaceRelease(rgb);

        // We need to flip the image twice in order to avoid drawing bugs on 10.4, see bug 465069.
        // This is the first flip transform, applied to cgContext.
        CGContextScaleCTM(cgContext, 1.0f, -1.0f);
        CGContextTranslateCTM(cgContext, 0.0f, -(2.0 * destRect.origin.y + destRect.size.height));
        if (mirrorHorizontal) {
          CGContextScaleCTM(cgContext, -1.0f, 1.0f);
          CGContextTranslateCTM(cgContext, -(2.0 * destRect.origin.x + destRect.size.width), 0.0f);
        }

        NSGraphicsContext* savedContext = [NSGraphicsContext currentContext];
        [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:ctx
                                                                                        flipped:YES]];

        CGContextScaleCTM(ctx, backingScaleFactor, backingScaleFactor);

        // Set the context's "base transform" to in order to get correctly-sized focus rings.
        CGContextSetBaseCTM(ctx, CGAffineTransformMakeScale(backingScaleFactor, backingScaleFactor));

        // This is the second flip transform, applied to ctx.
        CGContextScaleCTM(ctx, 1.0f, -1.0f);
        CGContextTranslateCTM(ctx, 0.0f, -(2.0 * tmpRect.origin.y + tmpRect.size.height));

        DrawCellIncludingFocusRing(cell, tmpRect, view);

        [NSGraphicsContext setCurrentContext:savedContext];

        CGImageRef img = CGBitmapContextCreateImage(ctx);

        // Drop the image into the original destination rectangle, scaling to fit
        // Only scale kMaxFocusRingWidth by xscale/yscale when the resulting rect
        // doesn't extend beyond the overflow rect
        float xscale = destRect.size.width / drawRect.size.width;
        float yscale = destRect.size.height / drawRect.size.height;
        float scaledFocusRingX = xscale < 1.0f ? kMaxFocusRingWidth * xscale : kMaxFocusRingWidth;
        float scaledFocusRingY = yscale < 1.0f ? kMaxFocusRingWidth * yscale : kMaxFocusRingWidth;
        CGContextDrawImage(
            cgContext,
            CGRectMake(destRect.origin.x - scaledFocusRingX, destRect.origin.y - scaledFocusRingY,
                       destRect.size.width + scaledFocusRingX * 2,
                       destRect.size.height + scaledFocusRingY * 2),
            img);

        CGImageRelease(img);
        CGContextRelease(ctx);
      }

      [NSGraphicsContext restoreGraphicsState];

    #if DRAW_IN_FRAME_DEBUG
      CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 0.5, 0.25);
      CGContextFillRect(cgContext, destRect);
    #endif

      NS_OBJC_END_TRY_IGNORE_BLOCK;
    }

## Minimal test - lines (288, 295)

path: .spaces[2].metrics.cyclomatic.sum
old: 4.0
new: 3.0
path: .spaces[2].metrics.cyclomatic.average
old: 4.0
new: 3.0
path: .spaces[2].metrics.nargs.average
old: 6.0
new: 1.0
path: .spaces[2].metrics.nargs.sum
old: 6.0
new: 1.0
path: .spaces[2].metrics.cognitive.sum
old: 2.0
new: 3.0
path: .spaces[2].metrics.cognitive.average
old: 2.0
new: 3.0
path: .spaces[2].metrics.loc.ploc
old: 16.0
new: 8.0
path: .spaces[2].metrics.loc.sloc
old: 19.0
new: 8.0
path: .spaces[2].metrics.loc.blank
old: 3.0
new: 0.0
path: .spaces[2].metrics.nexits.sum
old: 1.0
new: 3.0
path: .spaces[2].metrics.nexits.average
old: 1.0
new: 3.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.398829098036678
new: 1.7777777777777777
path: .spaces[2].metrics.halstead.length
old: 80.0
new: 27.0
path: .spaces[2].metrics.halstead.bugs
old: 0.13001673190804705
new: 0.022104188991842317
path: .spaces[2].metrics.halstead.n1
old: 15.0
new: 8.0
path: .spaces[2].metrics.halstead.N2
old: 37.0
new: 10.0
path: .spaces[2].metrics.halstead.level
old: 0.05045045045045045
new: 0.2
path: .spaces[2].metrics.halstead.N1
old: 43.0
new: 17.0
path: .spaces[2].metrics.halstead.effort
old: 7703.369863702293
new: 540.0
path: .spaces[2].metrics.halstead.time
old: 427.9649924279052
new: 30.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 111.90632784293425
new: 48.0
path: .spaces[2].metrics.halstead.vocabulary
old: 29.0
new: 16.0
path: .spaces[2].metrics.halstead.volume
old: 388.63847961020576
new: 108.0
path: .spaces[2].metrics.halstead.difficulty
old: 19.821428571428573
new: 5.0
path: .spaces[2].metrics.halstead.n2
old: 14.0
new: 8.0
path: .spaces[2].metrics.mi.mi_original
old: 91.37431086102632
new: 112.27596464374074
path: .spaces[2].metrics.mi.mi_sei
old: 56.531692589454295
new: 86.58458498874998
path: .spaces[2].metrics.mi.mi_visual_studio
old: 53.43526950937213
new: 65.65845885598874

### Code

    static NSControlSize CocoaSizeForEnum(int32_t enumControlSize) {
      if (enumControlSize == miniControlSize)
        return NSControlSizeMini;
      else if (enumControlSize == smallControlSize)
        return NSControlSizeSmall;
      else
        return NSControlSizeRegular;
    }

## Minimal test - lines (373, 381)

path: .spaces[7].metrics.nargs.average
old: 3.0
new: 1.0
path: .spaces[7].metrics.nargs.sum
old: 3.0
new: 1.0
path: .spaces[7].metrics.nexits.average
old: 1.0
new: 2.0
path: .spaces[7].metrics.nexits.sum
old: 1.0
new: 2.0
path: .spaces[7].metrics.loc.lloc
old: 5.0
new: 4.0
path: .spaces[7].metrics.loc.ploc
old: 12.0
new: 9.0
path: .spaces[7].metrics.loc.blank
old: 1.0
new: 0.0
path: .spaces[7].metrics.loc.sloc
old: 14.0
new: 9.0
path: .spaces[7].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[7].metrics.mi.mi_sei
old: 88.92195127589443
new: 78.91190480300362
path: .spaces[7].metrics.mi.mi_visual_studio
old: 58.45209340986723
new: 62.54834386295467
path: .spaces[7].metrics.mi.mi_original
old: 99.95307973087296
new: 106.95766800565248
path: .spaces[7].metrics.cognitive.average
old: 2.0
new: 3.0
path: .spaces[7].metrics.cognitive.sum
old: 2.0
new: 3.0
path: .spaces[7].metrics.halstead.estimated_program_length
old: 72.95445336320968
new: 81.07329781366414
path: .spaces[7].metrics.halstead.effort
old: 3232.7456231651677
new: 1929.504790710864
path: .spaces[7].metrics.halstead.time
old: 179.59697906473153
new: 107.194710595048
path: .spaces[7].metrics.halstead.n2
old: 7.0
new: 11.0
path: .spaces[7].metrics.halstead.N1
old: 30.0
new: 29.0
path: .spaces[7].metrics.halstead.difficulty
old: 16.0
new: 9.272727272727272
path: .spaces[7].metrics.halstead.n1
old: 14.0
new: 12.0
path: .spaces[7].metrics.halstead.bugs
old: 0.07287743859679725
new: 0.05166256754333802
path: .spaces[7].metrics.halstead.purity_ratio
old: 1.58596637746108
new: 1.7624629959492204
path: .spaces[7].metrics.halstead.level
old: 0.0625
new: 0.10784313725490197
path: .spaces[7].metrics.halstead.N2
old: 16.0
new: 17.0
path: .spaces[7].metrics.halstead.vocabulary
old: 21.0
new: 23.0
path: .spaces[7].metrics.halstead.volume
old: 202.04660144782295
new: 208.0838499786226

### Code

    static bool IsInSourceList(nsIFrame* aFrame) {
      for (nsIFrame* frame = aFrame->GetParent(); frame;
           frame = nsLayoutUtils::GetCrossDocParentFrame(frame)) {
        if (frame->StyleDisplay()->EffectiveAppearance() == StyleAppearance::MozMacSourceList) {
          return true;
        }
      }
      return false;
    }

## Minimal test - lines (645, 676)

path: .spaces[11].metrics.nargs.sum
old: 2.0
new: 3.0
path: .spaces[11].metrics.nargs.average
old: 2.0
new: 3.0
path: .spaces[11].metrics.nexits.sum
old: 1.0
new: 3.0
path: .spaces[11].metrics.nexits.average
old: 1.0
new: 3.0
path: .spaces[11].metrics.cognitive.sum
old: 6.0
new: 13.0
path: .spaces[11].metrics.cognitive.average
old: 6.0
new: 13.0
path: .spaces[11].metrics.halstead.N2
old: 30.0
new: 56.0
path: .spaces[11].metrics.halstead.n1
old: 11.0
new: 20.0
path: .spaces[11].metrics.halstead.time
old: 245.26873902505136
new: 1248.9068591586265
path: .spaces[11].metrics.halstead.effort
old: 4414.837302450925
new: 22480.32346485528
path: .spaces[11].metrics.halstead.vocabulary
old: 22.0
new: 37.0
path: .spaces[11].metrics.halstead.level
old: 0.06666666666666667
new: 0.03035714285714286
path: .spaces[11].metrics.halstead.length
old: 66.0
new: 131.0
path: .spaces[11].metrics.halstead.difficulty
old: 15.0
new: 32.94117647058823
path: .spaces[11].metrics.halstead.n2
old: 11.0
new: 17.0
path: .spaces[11].metrics.halstead.purity_ratio
old: 1.153143872879099
new: 1.1902704595343745
path: .spaces[11].metrics.halstead.N1
old: 36.0
new: 75.0
path: .spaces[11].metrics.halstead.volume
old: 294.3224868300616
new: 682.4383908973924
path: .spaces[11].metrics.halstead.estimated_program_length
old: 76.10749561002054
new: 155.92543019900302
path: .spaces[11].metrics.halstead.bugs
old: 0.08970608035150121
new: 0.26550973498110947
path: .spaces[11].metrics.cyclomatic.average
old: 5.0
new: 10.0
path: .spaces[11].metrics.cyclomatic.sum
old: 5.0
new: 10.0
path: .spaces[11].metrics.loc.blank
old: 5.0
new: 4.0
path: .spaces[11].metrics.loc.lloc
old: 10.0
new: 13.0
path: .spaces[11].metrics.loc.cloc
old: 0.0
new: 5.0
path: .spaces[11].metrics.loc.ploc
old: 17.0
new: 23.0
path: .spaces[11].metrics.loc.sloc
old: 22.0
new: 32.0
path: .spaces[11].metrics.mi.mi_visual_studio
old: 52.75719107760943
new: 45.97753371801828
path: .spaces[11].metrics.mi.mi_original
old: 90.21479674271212
new: 78.62158265781126
path: .spaces[11].metrics.mi.mi_sei
old: 54.96068718052615
new: 67.48483442501615

### Code

    static NSControlSize FindControlSize(CGFloat size, const CGFloat* sizes, CGFloat tolerance) {
      for (uint32_t i = miniControlSize; i <= regularControlSize; ++i) {
        if (sizes[i] == 0) {
          continue;
        }

        CGFloat next = 0;
        // Find next value.
        for (uint32_t j = i + 1; j <= regularControlSize; ++j) {
          if (sizes[j] != 0) {
            next = sizes[j];
            break;
          }
        }

        // If it's the latest value, we pick it.
        if (next == 0) {
          return CocoaSizeForEnum(i);
        }

        if (size <= sizes[i] + tolerance && size < next) {
          return CocoaSizeForEnum(i);
        }
      }

      // If we are here, that means sizes[] was an array with only empty values
      // or the algorithm above is wrong.
      // The former can happen but the later would be wrong.
      NS_ASSERTION(sizes[0] == 0 && sizes[1] == 0 && sizes[2] == 0,
                   "We found no control! We shouldn't be there!");
      return CocoaSizeForEnum(regularControlSize);
    }

## Minimal test - lines (754, 789)

path: .spaces[13].metrics.cyclomatic.sum
old: 5.0
new: 8.0
path: .spaces[13].metrics.cyclomatic.average
old: 5.0
new: 4.0
path: .spaces[13].metrics.mi.mi_original
old: 86.22084977065094
new: 75.16501957589445
path: .spaces[13].metrics.mi.mi_sei
old: 49.19863969036001
new: 60.844188607349864
path: .spaces[13].metrics.mi.mi_visual_studio
old: 50.421549573480085
new: 43.95615179876868
path: .spaces[13].metrics.nexits.average
old: 2.0
new: 0.5
path: .spaces[13].metrics.cognitive.sum
old: 5.0
new: 7.0
path: .spaces[13].metrics.cognitive.average
old: 5.0
new: 1.75
path: .spaces[13].metrics.halstead.volume
old: 335.20068866380245
new: 1004.1714012534482
path: .spaces[13].metrics.halstead.effort
old: 4849.236629336342
new: 17214.36687863054
path: .spaces[13].metrics.halstead.n1
old: 14.0
new: 18.0
path: .spaces[13].metrics.halstead.bugs
old: 0.09549801179334592
new: 0.22223175449727603
path: .spaces[13].metrics.halstead.level
old: 0.06912442396313365
new: 0.058333333333333334
path: .spaces[13].metrics.halstead.purity_ratio
old: 1.6218308383033948
new: 1.7737410693098208
path: .spaces[13].metrics.halstead.n2
old: 15.0
new: 42.0
path: .spaces[13].metrics.halstead.difficulty
old: 14.466666666666669
new: 17.142857142857142
path: .spaces[13].metrics.halstead.N1
old: 38.0
new: 90.0
path: .spaces[13].metrics.halstead.length
old: 69.0
new: 170.0
path: .spaces[13].metrics.halstead.time
old: 269.4020349631301
new: 956.3537154794744
path: .spaces[13].metrics.halstead.N2
old: 31.0
new: 80.0
path: .spaces[13].metrics.halstead.estimated_program_length
old: 111.90632784293425
new: 301.5359817826695
path: .spaces[13].metrics.halstead.vocabulary
old: 29.0
new: 60.0
path: .spaces[13].metrics.nargs.average
old: 3.0
new: 1.0
path: .spaces[13].metrics.nargs.sum
old: 3.0
new: 4.0
path: .spaces[13].metrics.loc.sloc
old: 27.0
new: 36.0
path: .spaces[13].metrics.loc.cloc
old: 0.0
new: 5.0
path: .spaces[13].metrics.loc.ploc
old: 19.0
new: 27.0
path: .spaces[13].metrics.loc.lloc
old: 9.0
new: 16.0
path: .spaces[13].metrics.loc.blank
old: 8.0
new: 4.0
path: .spaces[13].metrics.nom.closures
old: 0.0
new: 2.0
path: .spaces[13].metrics.nom.functions
old: 1.0
new: 2.0
path: .spaces[13].metrics.nom.total
old: 1.0
new: 4.0

### Code

    @end

    static id GetAquaAppearance() {
      Class NSAppearanceClass = NSClassFromString(@"NSAppearance");
      if (NSAppearanceClass && [NSAppearanceClass respondsToSelector:@selector(appearanceNamed:)]) {
        return [NSAppearanceClass performSelector:@selector(appearanceNamed:)
                                       withObject:@"NSAppearanceNameAqua"];
      }
      return nil;
    }

    @interface NSObject (NSAppearanceCoreUIRendering)
    - (void)_drawInRect:(CGRect)rect context:(CGContextRef)cgContext options:(id)options;
    @end

    static void RenderWithCoreUI(CGRect aRect, CGContextRef cgContext, NSDictionary* aOptions,
                                 bool aSkipAreaCheck = false) {
      id appearance = GetAquaAppearance();

      if (!aSkipAreaCheck && aRect.size.width * aRect.size.height > BITMAP_MAX_AREA) {
        return;
      }

      if (appearance && [appearance respondsToSelector:@selector(_drawInRect:context:options:)]) {
        // Render through NSAppearance on Mac OS 10.10 and up. This will call
        // CUIDraw with a CoreUI renderer that will give us the correct 10.10
        // style. Calling CUIDraw directly with [NSWindow coreUIRenderer] still
        // renders 10.9-style widgets on 10.10.
        [appearance _drawInRect:aRect context:cgContext options:aOptions];
      } else {
        // 10.9 and below
        CUIRendererRef renderer =
            [NSWindow respondsToSelector:@selector(coreUIRenderer)] ? [NSWindow coreUIRenderer] : nil;
        CUIDraw(renderer, aRect, cgContext, (CFDictionaryRef)aOptions, NULL);
      }
    }

## Minimal test - lines (688, 750)

path: .spaces[12].metrics.nargs.average
old: 2.0
new: 8.0
path: .spaces[12].metrics.nargs.sum
old: 2.0
new: 8.0
path: .spaces[12].metrics.cyclomatic.sum
old: 5.0
new: 11.0
path: .spaces[12].metrics.cyclomatic.average
old: 5.0
new: 11.0
path: .spaces[12].metrics.mi.mi_original
old: 84.62091806968685
new: 60.38278624266495
path: .spaces[12].metrics.mi.mi_visual_studio
old: 49.48591699981687
new: 35.311570902143245
path: .spaces[12].metrics.mi.mi_sei
old: 61.32070021752888
new: 31.559181965068205
path: .spaces[12].metrics.loc.ploc
old: 20.0
new: 50.0
path: .spaces[12].metrics.loc.cloc
old: 1.0
new: 4.0
path: .spaces[12].metrics.loc.blank
old: 7.0
new: 9.0
path: .spaces[12].metrics.loc.sloc
old: 28.0
new: 63.0
path: .spaces[12].metrics.loc.lloc
old: 14.0
new: 17.0
path: .spaces[12].metrics.cognitive.average
old: 5.0
new: 7.0
path: .spaces[12].metrics.cognitive.sum
old: 5.0
new: 7.0
path: .spaces[12].metrics.halstead.volume
old: 407.1205760451312
new: 2640.0270956076283
path: .spaces[12].metrics.halstead.bugs
old: 0.1294208696117586
new: 0.694409558874878
path: .spaces[12].metrics.halstead.difficulty
old: 18.791666666666668
new: 36.016129032258064
path: .spaces[12].metrics.halstead.level
old: 0.05321507760532151
new: 0.027765338110165697
path: .spaces[12].metrics.halstead.estimated_program_length
old: 81.07329781366414
new: 467.2676668540068
path: .spaces[12].metrics.halstead.purity_ratio
old: 0.9008144201518238
new: 1.1313987090896047
path: .spaces[12].metrics.halstead.effort
old: 7650.474158181424
new: 95083.55652406185
path: .spaces[12].metrics.halstead.n1
old: 11.0
new: 22.0
path: .spaces[12].metrics.halstead.n2
old: 12.0
new: 62.0
path: .spaces[12].metrics.halstead.vocabulary
old: 23.0
new: 84.0
path: .spaces[12].metrics.halstead.time
old: 425.0263421211902
new: 5282.419806892325
path: .spaces[12].metrics.halstead.length
old: 90.0
new: 413.0
path: .spaces[12].metrics.halstead.N1
old: 49.0
new: 210.0
path: .spaces[12].metrics.halstead.N2
old: 41.0
new: 203.0
path: .spaces[12].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[12].metrics.nexits.average
old: 2.0
new: 0.0

### Code

    static void DrawCellWithSnapping(NSCell* cell, CGContextRef cgContext, const HIRect& destRect,
                                     const CellRenderSettings settings, float verticalAlignFactor,
                                     NSView* view, BOOL mirrorHorizontal, float snapTolerance = 2.0f) {
      NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;

      const float rectWidth = destRect.size.width, rectHeight = destRect.size.height;
      const NSSize* sizes = settings.naturalSizes;
      const NSSize miniSize = sizes[EnumSizeForCocoaSize(NSControlSizeMini)];
      const NSSize smallSize = sizes[EnumSizeForCocoaSize(NSControlSizeSmall)];
      const NSSize regularSize = sizes[EnumSizeForCocoaSize(NSControlSizeRegular)];

      HIRect drawRect = destRect;

      CGFloat controlWidths[3] = {miniSize.width, smallSize.width, regularSize.width};
      NSControlSize controlSizeX = FindControlSize(rectWidth, controlWidths, snapTolerance);
      CGFloat controlHeights[3] = {miniSize.height, smallSize.height, regularSize.height};
      NSControlSize controlSizeY = FindControlSize(rectHeight, controlHeights, snapTolerance);

      NSControlSize controlSize = NSControlSizeRegular;
      size_t sizeIndex = 0;

      // At some sizes, don't scale but snap.
      const NSControlSize smallerControlSize =
          EnumSizeForCocoaSize(controlSizeX) < EnumSizeForCocoaSize(controlSizeY) ? controlSizeX
                                                                                  : controlSizeY;
      const size_t smallerControlSizeIndex = EnumSizeForCocoaSize(smallerControlSize);
      const NSSize size = sizes[smallerControlSizeIndex];
      float diffWidth = size.width ? rectWidth - size.width : 0.0f;
      float diffHeight = size.height ? rectHeight - size.height : 0.0f;
      if (diffWidth >= 0.0f && diffHeight >= 0.0f && diffWidth <= snapTolerance &&
          diffHeight <= snapTolerance) {
        // Snap to the smaller control size.
        controlSize = smallerControlSize;
        sizeIndex = smallerControlSizeIndex;
        MOZ_ASSERT(sizeIndex < ArrayLength(settings.naturalSizes));

        // Resize and center the drawRect.
        if (sizes[sizeIndex].width) {
          drawRect.origin.x += ceil((destRect.size.width - sizes[sizeIndex].width) / 2);
          drawRect.size.width = sizes[sizeIndex].width;
        }
        if (sizes[sizeIndex].height) {
          drawRect.origin.y +=
              floor((destRect.size.height - sizes[sizeIndex].height) * verticalAlignFactor);
          drawRect.size.height = sizes[sizeIndex].height;
        }
      } else {
        // Use the larger control size.
        controlSize = EnumSizeForCocoaSize(controlSizeX) > EnumSizeForCocoaSize(controlSizeY)
                          ? controlSizeX
                          : controlSizeY;
        sizeIndex = EnumSizeForCocoaSize(controlSize);
      }

      [cell setControlSize:controlSize];

      MOZ_ASSERT(sizeIndex < ArrayLength(settings.minimumSizes));
      const NSSize minimumSize = settings.minimumSizes[sizeIndex];
      DrawCellWithScaling(cell, cgContext, drawRect, controlSize, sizes[sizeIndex], minimumSize,
                          settings.margins, view, mirrorHorizontal);

      NS_OBJC_END_TRY_IGNORE_BLOCK;
    }

## Minimal test - lines (791, 816)

path: .spaces[14].metrics.mi.mi_visual_studio
old: 49.51524947277555
new: 48.50415309286201
path: .spaces[14].metrics.mi.mi_original
old: 84.67107659844619
new: 82.94210178879405
path: .spaces[14].metrics.mi.mi_sei
old: 46.962789620317466
new: 60.13960296366041
path: .spaces[14].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[14].metrics.loc.lloc
old: 10.0
new: 18.0
path: .spaces[14].metrics.loc.ploc
old: 21.0
new: 22.0
path: .spaces[14].metrics.loc.blank
old: 7.0
new: 3.0
path: .spaces[14].metrics.loc.sloc
old: 28.0
new: 26.0
path: .spaces[14].metrics.nargs.average
old: 4.0
new: 1.0
path: .spaces[14].metrics.nargs.sum
old: 4.0
new: 1.0
path: .spaces[14].metrics.halstead.time
old: 345.8106541010776
new: 350.2208451714473
path: .spaces[14].metrics.halstead.difficulty
old: 15.4375
new: 12.130434782608695
path: .spaces[14].metrics.halstead.N2
old: 38.0
new: 31.0
path: .spaces[14].metrics.halstead.n2
old: 16.0
new: 23.0
path: .spaces[14].metrics.halstead.vocabulary
old: 29.0
new: 41.0
path: .spaces[14].metrics.halstead.volume
old: 403.21242259558846
new: 519.6825444479541
path: .spaces[14].metrics.halstead.estimated_program_length
old: 112.1057163358342
new: 179.1005750152729
path: .spaces[14].metrics.halstead.N1
old: 45.0
new: 66.0
path: .spaces[14].metrics.halstead.n1
old: 13.0
new: 18.0
path: .spaces[14].metrics.halstead.purity_ratio
old: 1.3506712811546289
new: 1.846397680569824
path: .spaces[14].metrics.halstead.length
old: 83.0
new: 97.0
path: .spaces[14].metrics.halstead.level
old: 0.06477732793522267
new: 0.08243727598566308
path: .spaces[14].metrics.halstead.bugs
old: 0.11279399913055768
new: 0.11375096155912157
path: .spaces[14].metrics.halstead.effort
old: 6224.591773819397
new: 6303.975213086052
path: .spaces[14].metrics.cognitive.average
old: 5.0
new: 2.0
path: .spaces[14].metrics.cognitive.sum
old: 5.0
new: 2.0
path: .spaces[14].metrics.nexits.average
old: 1.0
new: 5.0
path: .spaces[14].metrics.nexits.sum
old: 1.0
new: 5.0
path: .spaces[14].metrics.cyclomatic.sum
old: 5.0
new: 12.0
path: .spaces[14].metrics.cyclomatic.average
old: 5.0
new: 12.0

### Code

    static float VerticalAlignFactor(nsIFrame* aFrame) {
      if (!aFrame) return 0.5f;  // default: center

      const auto& va = aFrame->StyleDisplay()->mVerticalAlign;
      auto kw = va.IsKeyword() ? va.AsKeyword() : StyleVerticalAlignKeyword::Middle;
      switch (kw) {
        case StyleVerticalAlignKeyword::Top:
        case StyleVerticalAlignKeyword::TextTop:
          return 0.0f;

        case StyleVerticalAlignKeyword::Sub:
        case StyleVerticalAlignKeyword::Super:
        case StyleVerticalAlignKeyword::Middle:
        case StyleVerticalAlignKeyword::MozMiddleWithBaseline:
          return 0.5f;

        case StyleVerticalAlignKeyword::Baseline:
        case StyleVerticalAlignKeyword::Bottom:
        case StyleVerticalAlignKeyword::TextBottom:
          return 1.0f;

        default:
          MOZ_ASSERT_UNREACHABLE("invalid vertical-align");
          return 0.5f;
      }
    }

## Minimal test - lines (319, 329)

path: .spaces[5].metrics.nargs.average
old: 4.0
new: 0.0
path: .spaces[5].metrics.nargs.sum
old: 4.0
new: 0.0
path: .spaces[5].metrics.cognitive.average
old: 2.0
new: 3.0
path: .spaces[5].metrics.cognitive.sum
old: 2.0
new: 3.0
path: .spaces[5].metrics.nexits.average
old: 1.0
new: 3.0
path: .spaces[5].metrics.nexits.sum
old: 1.0
new: 3.0
path: .spaces[5].metrics.loc.lloc
old: 4.0
new: 7.0
path: .spaces[5].metrics.loc.sloc
old: 15.0
new: 11.0
path: .spaces[5].metrics.loc.ploc
old: 12.0
new: 8.0
path: .spaces[5].metrics.mi.mi_visual_studio
old: 56.63253071735761
new: 59.4203606765324
path: .spaces[5].metrics.mi.mi_original
old: 96.84162752668152
new: 101.6088167568704
path: .spaces[5].metrics.mi.mi_sei
old: 64.41936322996467
new: 71.29696349133741
path: .spaces[5].metrics.halstead.bugs
old: 0.07598087609726595
new: 0.06570348203836295
path: .spaces[5].metrics.halstead.difficulty
old: 12.133333333333333
new: 9.285714285714286
path: .spaces[5].metrics.halstead.length
old: 59.0
new: 65.0
path: .spaces[5].metrics.halstead.n2
old: 15.0
new: 14.0
path: .spaces[5].metrics.halstead.volume
old: 283.6339404013986
new: 298.0225625468751
path: .spaces[5].metrics.halstead.estimated_program_length
old: 106.70907526996196
new: 86.52224985768008
path: .spaces[5].metrics.halstead.effort
old: 3441.4251435369697
new: 2767.3523665066978
path: .spaces[5].metrics.halstead.time
old: 191.19028575205388
new: 153.741798139261
path: .spaces[5].metrics.halstead.level
old: 0.08241758241758242
new: 0.10769230769230768
path: .spaces[5].metrics.halstead.N2
old: 28.0
new: 26.0
path: .spaces[5].metrics.halstead.n1
old: 13.0
new: 10.0
path: .spaces[5].metrics.halstead.purity_ratio
old: 1.8086283944061352
new: 1.3311115362720012
path: .spaces[5].metrics.halstead.N1
old: 31.0
new: 39.0
path: .spaces[5].metrics.halstead.vocabulary
old: 28.0
new: 24.0

### Code

    static NSWindow* NativeWindowForFrame(nsIFrame* aFrame, nsIWidget** aTopLevelWidget = NULL) {
      if (!aFrame) return nil;

      nsIWidget* widget = aFrame->GetNearestWidget();
      if (!widget) return nil;

      nsIWidget* topLevelWidget = widget->GetTopLevelWidget();
      if (aTopLevelWidget) *aTopLevelWidget = topLevelWidget;

      return (NSWindow*)topLevelWidget->GetNativeData(NS_NATIVE_WINDOW);
    }

## Minimal test - lines (331, 352)

path: .spaces[6].metrics.cognitive.average
old: 0.0
new: 0.25
path: .spaces[6].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[6].metrics.mi.mi_sei
old: 77.91788532260658
new: 66.16732702455356
path: .spaces[6].metrics.mi.mi_visual_studio
old: 62.18669143500867
new: 50.72672085541809
path: .spaces[6].metrics.mi.mi_original
old: 106.33924235386483
new: 86.74269266276494
path: .spaces[6].metrics.nexits.average
old: 1.0
new: 0.5
path: .spaces[6].metrics.nexits.sum
old: 1.0
new: 2.0
path: .spaces[6].metrics.nom.closures
old: 0.0
new: 3.0
path: .spaces[6].metrics.nom.total
old: 1.0
new: 4.0
path: .spaces[6].metrics.nargs.sum
old: 3.0
new: 1.0
path: .spaces[6].metrics.nargs.average
old: 3.0
new: 0.25
path: .spaces[6].metrics.loc.sloc
old: 10.0
new: 22.0
path: .spaces[6].metrics.loc.lloc
old: 1.0
new: 6.0
path: .spaces[6].metrics.loc.ploc
old: 8.0
new: 20.0
path: .spaces[6].metrics.loc.blank
old: 2.0
new: 1.0
path: .spaces[6].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[6].metrics.halstead.purity_ratio
old: 2.07880250804267
new: 1.3789067569906452
path: .spaces[6].metrics.halstead.time
old: 85.3508182958813
new: 398.5150521945115
path: .spaces[6].metrics.halstead.level
old: 0.11483253588516744
new: 0.08
path: .spaces[6].metrics.halstead.length
old: 39.0
new: 111.0
path: .spaces[6].metrics.halstead.N1
old: 20.0
new: 61.0
path: .spaces[6].metrics.halstead.bugs
old: 0.044381183049407656
new: 0.1239815043933602
path: .spaces[6].metrics.halstead.difficulty
old: 8.708333333333334
new: 12.5
path: .spaces[6].metrics.halstead.vocabulary
old: 23.0
new: 36.0
path: .spaces[6].metrics.halstead.effort
old: 1536.3147293258633
new: 7173.270939501208
path: .spaces[6].metrics.halstead.volume
old: 176.41891628622352
new: 573.8616751600966
path: .spaces[6].metrics.halstead.n2
old: 12.0
new: 24.0
path: .spaces[6].metrics.halstead.N2
old: 19.0
new: 50.0
path: .spaces[6].metrics.halstead.n1
old: 11.0
new: 12.0
path: .spaces[6].metrics.halstead.estimated_program_length
old: 81.07329781366414
new: 153.0586500259616
path: .spaces[6].metrics.cyclomatic.sum
old: 2.0
new: 5.0
path: .spaces[6].metrics.cyclomatic.average
old: 2.0
new: 5.0

### Code

    static NSSize WindowButtonsSize(nsIFrame* aFrame) {
      NSWindow* window = NativeWindowForFrame(aFrame);
      if (!window) {
        // Return fallback values.
        return NSMakeSize(54, 16);
      }

      NSRect buttonBox = NSZeroRect;
      NSButton* closeButton = [window standardWindowButton:NSWindowCloseButton];
      if (closeButton) {
        buttonBox = NSUnionRect(buttonBox, [closeButton frame]);
      }
      NSButton* minimizeButton = [window standardWindowButton:NSWindowMiniaturizeButton];
      if (minimizeButton) {
        buttonBox = NSUnionRect(buttonBox, [minimizeButton frame]);
      }
      NSButton* zoomButton = [window standardWindowButton:NSWindowZoomButton];
      if (zoomButton) {
        buttonBox = NSUnionRect(buttonBox, [zoomButton frame]);
      }
      return buttonBox.size;
    }

## Minimal test - lines (297, 304)

path: .spaces[3].metrics.nexits.sum
old: 1.0
new: 3.0
path: .spaces[3].metrics.nexits.average
old: 1.0
new: 3.0
path: .spaces[3].metrics.cognitive.average
old: 11.0
new: 3.0
path: .spaces[3].metrics.cognitive.sum
old: 11.0
new: 3.0
path: .spaces[3].metrics.cyclomatic.average
old: 10.0
new: 3.0
path: .spaces[3].metrics.cyclomatic.sum
old: 10.0
new: 3.0
path: .spaces[3].metrics.halstead.bugs
old: 0.27676210829554504
new: 0.02263393629738926
path: .spaces[3].metrics.halstead.n2
old: 27.0
new: 9.0
path: .spaces[3].metrics.halstead.vocabulary
old: 44.0
new: 17.0
path: .spaces[3].metrics.halstead.effort
old: 23924.442559895004
new: 559.5282467133798
path: .spaces[3].metrics.halstead.level
old: 0.039705882352941174
new: 0.20454545454545453
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.1371771888486748
new: 1.8760473218921716
path: .spaces[3].metrics.halstead.N1
old: 94.0
new: 17.0
path: .spaces[3].metrics.halstead.length
old: 174.0
new: 28.0
path: .spaces[3].metrics.halstead.n1
old: 17.0
new: 8.0
path: .spaces[3].metrics.halstead.volume
old: 949.9411016428896
new: 114.4489595550095
path: .spaces[3].metrics.halstead.N2
old: 80.0
new: 11.0
path: .spaces[3].metrics.halstead.difficulty
old: 25.185185185185187
new: 4.888888888888889
path: .spaces[3].metrics.halstead.estimated_program_length
old: 197.8688308596694
new: 52.529325012980806
path: .spaces[3].metrics.halstead.time
old: 1329.1356977719447
new: 31.084902595187764
path: .spaces[3].metrics.loc.blank
old: 6.0
new: 0.0
path: .spaces[3].metrics.loc.ploc
old: 42.0
new: 8.0
path: .spaces[3].metrics.loc.sloc
old: 53.0
new: 8.0
path: .spaces[3].metrics.loc.lloc
old: 18.0
new: 5.0
path: .spaces[3].metrics.loc.cloc
old: 5.0
new: 0.0
path: .spaces[3].metrics.nargs.average
old: 6.0
new: 0.0
path: .spaces[3].metrics.nargs.sum
old: 6.0
new: 0.0
path: .spaces[3].metrics.mi.mi_sei
old: 47.3747409187594
new: 86.14948520593762
path: .spaces[3].metrics.mi.mi_visual_studio
old: 40.191807650038214
new: 65.48209149474977
path: .spaces[3].metrics.mi.mi_original
old: 68.72799108156535
new: 111.9743764560221

### Code

    static NSString* CUIControlSizeForCocoaSize(NSControlSize aControlSize) {
      if (aControlSize == NSControlSizeRegular)
        return @"regular";
      else if (aControlSize == NSControlSizeSmall)
        return @"small";
      else
        return @"mini";
    }

## Minimal test - lines (279, 286)

path: .spaces[1].metrics.nargs.average
old: 3.0
new: 1.0
path: .spaces[1].metrics.nargs.sum
old: 3.0
new: 1.0
path: .spaces[1].metrics.halstead.time
old: 230.14279028814852
new: 30.0
path: .spaces[1].metrics.halstead.vocabulary
old: 30.0
new: 16.0
path: .spaces[1].metrics.halstead.n1
old: 13.0
new: 8.0
path: .spaces[1].metrics.halstead.N1
old: 37.0
new: 17.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.704240357059275
new: 1.7777777777777777
path: .spaces[1].metrics.halstead.N2
old: 32.0
new: 10.0
path: .spaces[1].metrics.halstead.difficulty
old: 12.235294117647058
new: 5.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 117.59258463708996
new: 48.0
path: .spaces[1].metrics.halstead.bugs
old: 0.0859789225008748
new: 0.022104188991842317
path: .spaces[1].metrics.halstead.length
old: 69.0
new: 27.0
path: .spaces[1].metrics.halstead.level
old: 0.08173076923076923
new: 0.2
path: .spaces[1].metrics.halstead.volume
old: 338.57545109698776
new: 108.0
path: .spaces[1].metrics.halstead.n2
old: 17.0
new: 8.0
path: .spaces[1].metrics.halstead.effort
old: 4142.570225186673
new: 540.0
path: .spaces[1].metrics.cyclomatic.average
old: 4.0
new: 3.0
path: .spaces[1].metrics.cyclomatic.sum
old: 4.0
new: 3.0
path: .spaces[1].metrics.nexits.average
old: 1.0
new: 3.0
path: .spaces[1].metrics.nexits.sum
old: 1.0
new: 3.0
path: .spaces[1].metrics.cognitive.average
old: 4.0
new: 3.0
path: .spaces[1].metrics.cognitive.sum
old: 4.0
new: 3.0
path: .spaces[1].metrics.loc.blank
old: 3.0
new: 0.0
path: .spaces[1].metrics.loc.sloc
old: 23.0
new: 8.0
path: .spaces[1].metrics.loc.ploc
old: 19.0
new: 8.0
path: .spaces[1].metrics.loc.lloc
old: 8.0
new: 5.0
path: .spaces[1].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[1].metrics.mi.mi_original
old: 88.99630947936939
new: 112.27596464374074
path: .spaces[1].metrics.mi.mi_visual_studio
old: 52.04462542653181
new: 65.65845885598874
path: .spaces[1].metrics.mi.mi_sei
old: 68.97298584805316
new: 86.58458498874998

### Code

    static size_t EnumSizeForCocoaSize(NSControlSize cocoaControlSize) {
      if (cocoaControlSize == NSControlSizeMini)
        return miniControlSize;
      else if (cocoaControlSize == NSControlSizeSmall)
        return smallControlSize;
      else
        return regularControlSize;
    }

## Minimal test - lines (620, 634)

path: .spaces[10].metrics.halstead.level
old: 0.07142857142857142
new: 0.3636363636363637
path: .spaces[10].metrics.halstead.n1
old: 11.0
new: 4.0
path: .spaces[10].metrics.halstead.bugs
old: 0.08128997655011974
new: 0.011665494389792322
path: .spaces[10].metrics.halstead.length
old: 61.0
new: 21.0
path: .spaces[10].metrics.halstead.n2
old: 11.0
new: 8.0
path: .spaces[10].metrics.halstead.volume
old: 272.0253287368751
new: 75.28421251514428
path: .spaces[10].metrics.halstead.N1
old: 33.0
new: 10.0
path: .spaces[10].metrics.halstead.time
old: 211.5752556842362
new: 11.501754689813708
path: .spaces[10].metrics.halstead.N2
old: 28.0
new: 11.0
path: .spaces[10].metrics.halstead.effort
old: 3808.354602316252
new: 207.03158441664675
path: .spaces[10].metrics.halstead.vocabulary
old: 22.0
new: 12.0
path: .spaces[10].metrics.halstead.difficulty
old: 14.0
new: 2.75
path: .spaces[10].metrics.halstead.estimated_program_length
old: 76.10749561002054
new: 32.0
path: .spaces[10].metrics.halstead.purity_ratio
old: 1.247663862459353
new: 1.5238095238095235
path: .spaces[10].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[10].metrics.nexits.average
old: 1.0
new: null
path: .spaces[10].metrics.nargs.average
old: 2.0
new: null
path: .spaces[10].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[10].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[10].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[10].metrics.cognitive.sum
old: 4.0
new: 0.0
path: .spaces[10].metrics.cognitive.average
old: 4.0
new: null
path: .spaces[10].metrics.mi.mi_original
old: 91.6080815608336
new: 104.42898039345806
path: .spaces[10].metrics.mi.mi_visual_studio
old: 53.57197752095532
new: 61.06957917746085
path: .spaces[10].metrics.mi.mi_sei
old: 56.868952418771386
new: 120.30995130368176
path: .spaces[10].metrics.loc.ploc
old: 15.0
new: 5.0
path: .spaces[10].metrics.loc.blank
old: 6.0
new: 2.0
path: .spaces[10].metrics.loc.cloc
old: 0.0
new: 8.0
path: .spaces[10].metrics.loc.sloc
old: 21.0
new: 15.0
path: .spaces[10].metrics.loc.lloc
old: 9.0
new: 0.0
path: .spaces[10].metrics.cyclomatic.sum
old: 4.0
new: 1.0
path: .spaces[10].metrics.cyclomatic.average
old: 4.0
new: 1.0

### Code

    struct CellRenderSettings {
      // The natural dimensions of the control.
      // If a control has no natural dimensions in either/both axes, set to 0.0f.
      NSSize naturalSizes[3];

      // The minimum dimensions of the control.
      // If a control has no minimum dimensions in either/both axes, set to 0.0f.
      NSSize minimumSizes[3];

      // A three-dimensional array,
      // with the first dimension being the OS version ([0] 10.6-10.9, [1] 10.10 and above),
      // the second being the control size (mini, small, regular), and the third
      // being the 4 margin values (left, top, right, bottom).
      float margins[2][3][4];
    };