Global Metrics

path: .metrics.loc.ploc
old: 787.0
new: 34.0

path: .metrics.loc.cloc
old: 141.0
new: 8.0

path: .metrics.loc.sloc
old: 1112.0
new: 50.0

path: .metrics.loc.blank
old: 184.0
new: 8.0

path: .metrics.loc.lloc
old: 46.0
new: 10.0

path: .metrics.halstead.vocabulary
old: 834.0
new: 55.0

path: .metrics.halstead.N2
old: 1449.0
new: 63.0

path: .metrics.halstead.bugs
old: 3.0191619876067066
new: 0.16648037174274935

path: .metrics.halstead.effort
old: 862008.4130130892
new: 11161.599561662271

path: .metrics.halstead.n2
old: 803.0
new: 38.0

path: .metrics.halstead.purity_ratio
old: 2.4880141045870263
new: 1.962832947533664

path: .metrics.halstead.time
old: 47889.35627850496
new: 620.0888645367929

path: .metrics.halstead.length
old: 3176.0
new: 137.0

path: .metrics.halstead.N1
old: 1727.0
new: 74.0

path: .metrics.halstead.n1
old: 31.0
new: 17.0

path: .metrics.halstead.volume
old: 30819.59774926025
new: 792.0462807528784

path: .metrics.halstead.estimated_program_length
old: 7901.932796168396
new: 268.908113812112

path: .metrics.halstead.level
old: 0.03575324472940181
new: 0.07096171802054155

path: .metrics.halstead.difficulty
old: 27.969489414694895
new: 14.092105263157896

path: .metrics.cyclomatic.average
old: 1.40625
new: 1.1666666666666667

path: .metrics.cyclomatic.sum
old: 90.0
new: 7.0

path: .metrics.mi.mi_original
old: -17.072142189240836
new: 71.30720421997783

path: .metrics.mi.mi_sei
old: -64.96234578598708
new: 56.92506295779476

path: .metrics.mi.mi_visual_studio
old: 0.0
new: 41.70011942688762

path: .metrics.nargs.average
old: 1.5769230769230769
new: 1.6666666666666667

path: .metrics.nargs.sum
old: 41.0
new: 5.0

path: .metrics.nexits.average
old: 0.8846153846153846
new: 0.6666666666666666

path: .metrics.nexits.sum
old: 23.0
new: 2.0

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

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

path: .metrics.cognitive.sum
old: 21.0
new: 1.0

path: .metrics.cognitive.average
old: 0.8076923076923077
new: 0.3333333333333333

Spaces Data

Minimal test - lines (14, 50)

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

path: .spaces[0].metrics.nexits.average
old: null
new: 0.6666666666666666

path: .spaces[0].metrics.halstead.n2
old: 16.0
new: 32.0

path: .spaces[0].metrics.halstead.time
old: 28.824583086985612
new: 618.6854625886635

path: .spaces[0].metrics.halstead.bugs
old: 0.021522981794137173
new: 0.1662290883006465

path: .spaces[0].metrics.halstead.length
old: 42.0
new: 131.0

path: .spaces[0].metrics.halstead.effort
old: 518.842495565741
new: 11136.338326595944

path: .spaces[0].metrics.halstead.difficulty
old: 2.8125
new: 15.140625

path: .spaces[0].metrics.halstead.level
old: 0.35555555555555557
new: 0.06604747162022703

path: .spaces[0].metrics.halstead.estimated_program_length
old: 75.60964047443682
new: 229.48686830125575

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.8002295351056383
new: 1.751808154971418

path: .spaces[0].metrics.halstead.N2
old: 18.0
new: 57.0

path: .spaces[0].metrics.halstead.N1
old: 24.0
new: 74.0

path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 17.0

path: .spaces[0].metrics.halstead.vocabulary
old: 21.0
new: 49.0

path: .spaces[0].metrics.halstead.volume
old: 184.4773317567079
new: 735.5269895790923

path: .spaces[0].metrics.nargs.average
old: null
new: 1.6666666666666667

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

path: .spaces[0].metrics.mi.mi_visual_studio
old: 57.73270433744179
new: 44.9123252594001

path: .spaces[0].metrics.mi.mi_sei
old: 92.86525632152632
new: 57.05717887774074

path: .spaces[0].metrics.mi.mi_original
old: 98.72292441702544
new: 76.80007619357417

path: .spaces[0].metrics.cognitive.average
old: null
new: 0.3333333333333333

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

path: .spaces[0].metrics.loc.blank
old: 4.0
new: 7.0

path: .spaces[0].metrics.loc.sloc
old: 16.0
new: 37.0

path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 10.0

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

path: .spaces[0].metrics.loc.ploc
old: 10.0
new: 27.0

path: .spaces[0].metrics.nom.functions
old: 0.0
new: 3.0

path: .spaces[0].metrics.nom.total
old: 0.0
new: 3.0

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

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

Code

namespace mozilla {
namespace widget {

HeadlessKeyBindings& HeadlessKeyBindings::GetInstance() {
  static UniquePtr sInstance;
  if (!sInstance) {
    sInstance.reset(new HeadlessKeyBindings());
    ClearOnShutdown(&sInstance);
  }
  return *sInstance;
}

nsresult HeadlessKeyBindings::AttachNativeKeyEvent(WidgetKeyboardEvent& aEvent) {
  NS_OBJC_BEGIN_TRY_BLOCK_RETURN;

  aEvent.mNativeKeyEvent = nsCocoaUtils::MakeNewCococaEventFromWidgetEvent(aEvent, 0, nil);

  return NS_OK;

  NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE);
}

void HeadlessKeyBindings::GetEditCommands(nsIWidget::NativeKeyBindingsType aType,
                                          const WidgetKeyboardEvent& aEvent,
                                          const Maybe& aWritingMode,
                                          nsTArray& aCommands) {
  // Convert the widget keyboard into a cocoa event so it can be translated
  // into commands in the NativeKeyBindings.
  WidgetKeyboardEvent modifiedEvent(aEvent);
  modifiedEvent.mNativeKeyEvent = nsCocoaUtils::MakeNewCococaEventFromWidgetEvent(aEvent, 0, nil);

  NativeKeyBindings* keyBindings = NativeKeyBindings::GetInstance(aType);
  keyBindings->GetEditCommands(modifiedEvent, aWritingMode, aCommands);
}

}  // namespace widget
}  // namespace mozilla