Global Metrics

path: .metrics.mi.mi_sei
old: 43.11489230467268
new: -34.36465802953987

path: .metrics.mi.mi_original
old: 70.83453868010855
new: 35.34932859648443

path: .metrics.mi.mi_visual_studio
old: 41.42370683047284
new: 20.672121986248207

path: .metrics.nargs.sum
old: 6.0
new: 19.0

path: .metrics.nargs.average
old: 2.0
new: 0.5135135135135135

path: .metrics.cyclomatic.average
old: 1.0
new: 5.0

path: .metrics.cyclomatic.sum
old: 4.0
new: 140.0

path: .metrics.loc.cloc
old: 2.0
new: 127.0

path: .metrics.loc.blank
old: 6.0
new: 0.0

path: .metrics.loc.sloc
old: 44.0
new: 23.0

path: .metrics.loc.lloc
old: 11.0
new: 248.0

path: .metrics.loc.ploc
old: 36.0
new: 555.0

path: .metrics.cognitive.sum
old: 0.0
new: 115.0

path: .metrics.cognitive.average
old: 0.0
new: 3.108108108108108

path: .metrics.nom.functions
old: 3.0
new: 28.0

path: .metrics.nom.total
old: 3.0
new: 37.0

path: .metrics.nom.closures
old: 0.0
new: 9.0

path: .metrics.halstead.n1
old: 11.0
new: 34.0

path: .metrics.halstead.volume
old: 1475.0681502026314
new: 24986.46215448894

path: .metrics.halstead.level
old: 0.07053291536050157
new: 0.015850356879153333

path: .metrics.halstead.n2
old: 45.0
new: 322.0

path: .metrics.halstead.purity_ratio
old: 1.1227840044875812
new: 0.9686326225764648

path: .metrics.halstead.estimated_program_length
old: 285.1871371398456
new: 2855.5289713554184

path: .metrics.halstead.bugs
old: 0.25302236597178185
new: 4.514980659156873

path: .metrics.halstead.N1
old: 138.0
new: 1753.0

path: .metrics.halstead.difficulty
old: 14.177777777777775
new: 63.090062111801245

path: .metrics.halstead.N2
old: 116.0
new: 1195.0

path: .metrics.halstead.effort
old: 20913.18844065064
new: 1576397.4492808783

path: .metrics.halstead.length
old: 254.0
new: 2948.0

path: .metrics.halstead.time
old: 1161.843802258369
new: 87577.63607115991

path: .metrics.halstead.vocabulary
old: 56.0
new: 356.0

path: .metrics.nexits.average
old: 0.0
new: 1.027027027027027

path: .metrics.nexits.sum
old: 0.0
new: 38.0

Spaces Data

Minimal test - lines (167, 187)

path: .spaces[0].metrics.nargs.average
old: 2.0
new: 0.0

path: .spaces[0].metrics.nargs.sum
old: 2.0
new: 0.0

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.0781352324002231
new: 2.0405031085111425

path: .spaces[0].metrics.halstead.n1
old: 9.0
new: 10.0

path: .spaces[0].metrics.halstead.volume
old: 861.5205616745466
new: 208.9735285398626

path: .spaces[0].metrics.halstead.difficulty
old: 11.1
new: 6.333333333333333

path: .spaces[0].metrics.halstead.effort
old: 9562.878234587466
new: 1323.4990140857965

path: .spaces[0].metrics.halstead.bugs
old: 0.15017737050003163
new: 0.04018165557479973

path: .spaces[0].metrics.halstead.estimated_program_length
old: 175.7360428812364
new: 91.8226398830014

path: .spaces[0].metrics.halstead.time
old: 531.271013032637
new: 73.52772300476647

path: .spaces[0].metrics.halstead.length
old: 163.0
new: 45.0

path: .spaces[0].metrics.halstead.n2
old: 30.0
new: 15.0

path: .spaces[0].metrics.halstead.N1
old: 89.0
new: 26.0

path: .spaces[0].metrics.halstead.level
old: 0.0900900900900901
new: 0.15789473684210528

path: .spaces[0].metrics.halstead.N2
old: 74.0
new: 19.0

path: .spaces[0].metrics.halstead.vocabulary
old: 39.0
new: 25.0

path: .spaces[0].metrics.nom.total
old: 1.0
new: 2.0

path: .spaces[0].metrics.nom.closures
old: 0.0
new: 1.0

path: .spaces[0].metrics.loc.ploc
old: 22.0
new: 13.0

path: .spaces[0].metrics.loc.lloc
old: 8.0
new: 7.0

path: .spaces[0].metrics.loc.blank
old: 2.0
new: 5.0

path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 3.0

path: .spaces[0].metrics.loc.sloc
old: 24.0
new: 21.0

path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 2.0

path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.0

path: .spaces[0].metrics.mi.mi_original
old: 84.14029354887742
new: 93.43925706043754

path: .spaces[0].metrics.mi.mi_sei
old: 45.789752109298774
new: 86.93961765233075

path: .spaces[0].metrics.mi.mi_visual_studio
old: 49.20485002858329
new: 54.64284038622078

Code

nsMenuX::~nsMenuX() {
  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;

  RemoveAll();

  mNativeMenu.delegate = nil;
  [mNativeMenu release];
  [mMenuDelegate release];
  // autorelease the native menu item so that anything else happening to this
  // object happens before the native menu item actually dies
  [mNativeMenuItem autorelease];

  // alert the change notifier we don't care no more
  if (mContent) {
    mMenuGroupOwner->UnregisterForContentChanges(mContent);
  }

  MOZ_COUNT_DTOR(nsMenuX);

  NS_OBJC_END_TRY_ABORT_BLOCK;
}

Minimal test - lines (189, 219)

path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 1.0

path: .spaces[1].metrics.nexits.average
old: 0.0
new: 1.0

path: .spaces[1].metrics.mi.mi_original
old: 114.30754370347049
new: 80.80275788698549

path: .spaces[1].metrics.mi.mi_sei
old: 126.14356188672652
new: 64.3529271822201

path: .spaces[1].metrics.mi.mi_visual_studio
old: 66.84651678565525
new: 47.253074787710815

path: .spaces[1].metrics.loc.ploc
old: 5.0
new: 19.0

path: .spaces[1].metrics.loc.blank
old: 0.0
new: 9.0

path: .spaces[1].metrics.loc.sloc
old: 7.0
new: 31.0

path: .spaces[1].metrics.loc.lloc
old: 2.0
new: 12.0

path: .spaces[1].metrics.loc.cloc
old: 2.0
new: 3.0

path: .spaces[1].metrics.cognitive.average
old: 0.0
new: 1.0

path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 1.0

path: .spaces[1].metrics.halstead.difficulty
old: 4.333333333333333
new: 12.75

path: .spaces[1].metrics.halstead.estimated_program_length
old: 67.01955000865388
new: 242.46060490376732

path: .spaces[1].metrics.halstead.length
old: 28.0
new: 119.0

path: .spaces[1].metrics.halstead.N1
old: 15.0
new: 68.0

path: .spaces[1].metrics.halstead.n2
old: 12.0
new: 34.0

path: .spaces[1].metrics.halstead.effort
old: 524.3939421796666
new: 8606.48735010625

path: .spaces[1].metrics.halstead.purity_ratio
old: 2.393555357451924
new: 2.037484074821574

path: .spaces[1].metrics.halstead.time
old: 29.132996787759257
new: 478.1381861170139

path: .spaces[1].metrics.halstead.n1
old: 8.0
new: 17.0

path: .spaces[1].metrics.halstead.N2
old: 13.0
new: 51.0

path: .spaces[1].metrics.halstead.vocabulary
old: 20.0
new: 51.0

path: .spaces[1].metrics.halstead.volume
old: 121.01398665684616
new: 675.0186156946079

path: .spaces[1].metrics.halstead.bugs
old: 0.021676235263292952
new: 0.13998968461886627

path: .spaces[1].metrics.halstead.level
old: 0.2307692307692308
new: 0.0784313725490196

path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 3.0

path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 3.0

path: .spaces[1].metrics.nargs.average
old: 2.0
new: 1.0

path: .spaces[1].metrics.nargs.sum
old: 2.0
new: 1.0

Code

void nsMenuX::AddMenuItem(UniquePtr&& aMenuItem) {
  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;

  nsMenuItemX* menuItem = aMenuItem.get();
  mMenuObjectsArray.AppendElement(std::move(aMenuItem));

  if (nsMenuUtilsX::NodeIsHiddenOrCollapsed(menuItem->Content())) {
    return;
  }

  ++mVisibleItemsCount;

  NSMenuItem* newNativeMenuItem = (NSMenuItem*)menuItem->NativeData();

  // add the menu item to this menu
  [mNativeMenu addItem:newNativeMenuItem];

  // set up target/action
  newNativeMenuItem.target = nsMenuBarX::sNativeEventTarget;
  newNativeMenuItem.action = @selector(menuItemHit:);

  // set its command. we get the unique command id from the menubar
  newNativeMenuItem.tag = mMenuGroupOwner->RegisterForCommand(menuItem);
  MenuItemInfo* info = [[MenuItemInfo alloc] initWithMenuGroupOwner:mMenuGroupOwner];
  newNativeMenuItem.representedObject = info;
  [info release];

  menuItem->SetupIcon();

  NS_OBJC_END_TRY_ABORT_BLOCK;
}

Minimal test - lines (221, 245)

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.nexits.sum
old: 0.0
new: 1.0

path: .spaces[2].metrics.nexits.average
old: 0.0
new: 1.0

path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 2.0

path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 2.0

path: .spaces[2].metrics.loc.sloc
old: 6.0
new: 25.0

path: .spaces[2].metrics.loc.ploc
old: 6.0
new: 16.0

path: .spaces[2].metrics.loc.lloc
old: 1.0
new: 10.0

path: .spaces[2].metrics.loc.blank
old: 0.0
new: 6.0

path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 3.0

path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 4.0

path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 4.0

path: .spaces[2].metrics.halstead.vocabulary
old: 23.0
new: 40.0

path: .spaces[2].metrics.halstead.purity_ratio
old: 1.363871565363121
new: 2.065818967744846

path: .spaces[2].metrics.halstead.length
old: 60.0
new: 84.0

path: .spaces[2].metrics.halstead.N1
old: 34.0
new: 51.0

path: .spaces[2].metrics.halstead.n1
old: 9.0
new: 17.0

path: .spaces[2].metrics.halstead.level
old: 0.11965811965811964
new: 0.08199643493761141

path: .spaces[2].metrics.halstead.estimated_program_length
old: 81.83229392178727
new: 173.52879329056708

path: .spaces[2].metrics.halstead.N2
old: 26.0
new: 33.0

path: .spaces[2].metrics.halstead.bugs
old: 0.05754467719832204
new: 0.10325576072998914

path: .spaces[2].metrics.halstead.volume
old: 271.4137173634208
new: 447.04195997053847

path: .spaces[2].metrics.halstead.n2
old: 14.0
new: 23.0

path: .spaces[2].metrics.halstead.difficulty
old: 8.357142857142858
new: 12.195652173913045

path: .spaces[2].metrics.halstead.effort
old: 2268.2432093943025
new: 5451.968250945045

path: .spaces[2].metrics.halstead.time
old: 126.0135116330168
new: 302.8871250525025

path: .spaces[2].metrics.mi.mi_visual_studio
old: 65.850611868534
new: 50.4096016626412

path: .spaces[2].metrics.mi.mi_original
old: 112.60454629519312
new: 86.20041884311645

path: .spaces[2].metrics.mi.mi_sei
old: 86.85498838901856
new: 74.6306049793481

Code

void nsMenuX::AddMenu(UniquePtr&& aMenu) {
  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;

  // aMenu transfers ownership to mMenuObjectsArray and becomes nullptr, so
  // we need to keep a raw pointer to access it conveniently.
  nsMenuX* menu = aMenu.get();
  mMenuObjectsArray.AppendElement(std::move(aMenu));

  if (nsMenuUtilsX::NodeIsHiddenOrCollapsed(menu->Content())) {
    return;
  }

  ++mVisibleItemsCount;

  // We have to add a menu item and then associate the menu with it
  NSMenuItem* newNativeMenuItem = menu->NativeMenuItem();
  if (newNativeMenuItem) {
    [mNativeMenu addItem:newNativeMenuItem];
    newNativeMenuItem.submenu = (NSMenu*)menu->NativeData();
  }

  menu->SetupIcon();

  NS_OBJC_END_TRY_ABORT_BLOCK;
}