Global Metrics

path: .metrics.nargs.sum
old: 0.0
new: 7.0

path: .metrics.nargs.average
old: null
new: 0.35

path: .metrics.nom.functions
old: 0.0
new: 20.0

path: .metrics.nom.total
old: 0.0
new: 20.0

path: .metrics.cyclomatic.sum
old: 3.0
new: 79.0

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

path: .metrics.mi.mi_visual_studio
old: 43.121527994589
new: 2.1747390132365725

path: .metrics.mi.mi_original
old: 73.73781287074719
new: 3.7188037126345392

path: .metrics.mi.mi_sei
old: 76.90495407657609
new: -43.13931959507288

path: .metrics.loc.sloc
old: 62.0
new: 497.0

path: .metrics.loc.ploc
old: 22.0
new: 367.0

path: .metrics.loc.blank
old: 5.0
new: 98.0

path: .metrics.loc.cloc
old: 35.0
new: 32.0

path: .metrics.loc.lloc
old: 0.0
new: 136.0

path: .metrics.cognitive.average
old: null
new: 2.55

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

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

path: .metrics.nexits.average
old: null
new: 2.25

path: .metrics.halstead.volume
old: 303.0699021717345
new: 11305.94762502596

path: .metrics.halstead.difficulty
old: 10.125
new: 43.67391304347826

path: .metrics.halstead.n2
old: 12.0
new: 184.0

path: .metrics.halstead.bugs
old: 0.07038886662215978
new: 2.0824030674245537

path: .metrics.halstead.n1
old: 9.0
new: 28.0

path: .metrics.halstead.N1
old: 42.0
new: 889.0

path: .metrics.halstead.N2
old: 27.0
new: 574.0

path: .metrics.halstead.level
old: 0.09876543209876544
new: 0.022896963663514187

path: .metrics.halstead.length
old: 69.0
new: 1463.0

path: .metrics.halstead.estimated_program_length
old: 71.54887502163469
new: 1518.9413377321032

path: .metrics.halstead.time
old: 170.47681997160066
new: 27431.94296941685

path: .metrics.halstead.effort
old: 3068.582759488812
new: 493774.9734495033

path: .metrics.halstead.vocabulary
old: 21.0
new: 212.0

path: .metrics.halstead.purity_ratio
old: 1.0369402177048506
new: 1.038237414717774

Spaces Data

Minimal test - lines (114, 126)

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

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

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

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

path: .spaces[1].metrics.halstead.effort
old: 99.65784284662088
new: 2067.5567115262947

path: .spaces[1].metrics.halstead.time
old: 5.5365468248122705
new: 114.86426175146082

path: .spaces[1].metrics.halstead.bugs
old: 0.007165058383377737
new: 0.05409831011340209

path: .spaces[1].metrics.halstead.volume
old: 33.219280948873624
new: 233.18308776612344

path: .spaces[1].metrics.halstead.vocabulary
old: 10.0
new: 29.0

path: .spaces[1].metrics.halstead.length
old: 10.0
new: 48.0

path: .spaces[1].metrics.halstead.n2
old: 4.0
new: 15.0

path: .spaces[1].metrics.halstead.purity_ratio
old: 2.350977500432694
new: 2.33138183006113

path: .spaces[1].metrics.halstead.level
old: 0.3333333333333333
new: 0.11278195488721804

path: .spaces[1].metrics.halstead.N2
old: 4.0
new: 19.0

path: .spaces[1].metrics.halstead.difficulty
old: 3.0
new: 8.866666666666667

path: .spaces[1].metrics.halstead.estimated_program_length
old: 23.509775004326936
new: 111.90632784293425

path: .spaces[1].metrics.halstead.n1
old: 6.0
new: 14.0

path: .spaces[1].metrics.halstead.N1
old: 6.0
new: 29.0

path: .spaces[1].metrics.mi.mi_original
old: 152.55372161411694
new: 100.63833597622887

path: .spaces[1].metrics.mi.mi_visual_studio
old: 89.21270269831399
new: 58.8528280562742

path: .spaces[1].metrics.mi.mi_sei
old: 144.4894655092337
new: 90.521708124441

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

path: .spaces[1].metrics.nexits.average
old: null
new: 2.0

path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 1.0

path: .spaces[1].metrics.loc.ploc
old: 1.0
new: 10.0

path: .spaces[1].metrics.loc.sloc
old: 1.0
new: 13.0

path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 5.0

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

path: .spaces[1].metrics.nom.total
old: 0.0
new: 1.0

path: .spaces[1].metrics.nom.functions
old: 0.0
new: 1.0

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

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

Code

bool WakeLockTopic::SendMessage(DBusMessage* aMessage) {
  // send message and get a handle for a reply
  RefPtr reply;
  dbus_connection_send_with_reply(mConnection, aMessage,
                                  reply.StartAssignment(), DBUS_TIMEOUT);
  if (!reply) {
    return false;
  }

  dbus_pending_call_set_notify(reply, &ReceiveInhibitReply, this, NULL);

  return true;
}

Minimal test - lines (61, 112)

path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 52.0

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

path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 42.0

path: .spaces[0].metrics.halstead.N1
old: 7.0
new: 92.0

path: .spaces[0].metrics.halstead.difficulty
old: 3.0
new: 6.521739130434782

path: .spaces[0].metrics.halstead.n2
old: 5.0
new: 46.0

path: .spaces[0].metrics.halstead.purity_ratio
old: 2.259951289896979
new: 1.8901521771545804

path: .spaces[0].metrics.halstead.effort
old: 124.53953827094271
new: 5756.856183604928

path: .spaces[0].metrics.halstead.volume
old: 41.51317942364757
new: 882.7179481527558

path: .spaces[0].metrics.halstead.bugs
old: 0.00831285578253799
new: 0.1070702948691296

path: .spaces[0].metrics.halstead.time
old: 6.9188632372745955
new: 319.8253435336071

path: .spaces[0].metrics.halstead.vocabulary
old: 11.0
new: 56.0

path: .spaces[0].metrics.halstead.level
old: 0.3333333333333333
new: 0.15333333333333335

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

path: .spaces[0].metrics.halstead.length
old: 12.0
new: 152.0

path: .spaces[0].metrics.halstead.N2
old: 5.0
new: 60.0

path: .spaces[0].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 287.3031309274962

path: .spaces[0].metrics.mi.mi_visual_studio
old: 88.53493745197343
new: 41.805977771146786

path: .spaces[0].metrics.mi.mi_original
old: 151.39474304287458
new: 71.488221988661

path: .spaces[0].metrics.mi.mi_sei
old: 142.81741287200575
new: 27.536671212402283

Code

class WakeLockTopic {
 public:
  WakeLockTopic(const nsAString& aTopic, DBusConnection* aConnection)
      :
#  if defined(MOZ_WAYLAND)
        mWaylandInhibitor(nullptr),
#  endif
        mTopic(NS_ConvertUTF16toUTF8(aTopic)),
        mConnection(aConnection),
        mDesktopEnvironment(FreeDesktop),
        mInhibitRequest(0),
        mShouldInhibit(false),
        mWaitingForReply(false) {
  }

  nsresult InhibitScreensaver(void);
  nsresult UninhibitScreensaver(void);

 private:
  bool SendInhibit();
  bool SendUninhibit();

  bool SendFreeDesktopInhibitMessage();
  bool SendGNOMEInhibitMessage();
  bool SendMessage(DBusMessage* aMessage);

#  if defined(MOZ_X11)
  static bool CheckXScreenSaverSupport();
  static bool InhibitXScreenSaver(bool inhibit);
#  endif

#  if defined(MOZ_WAYLAND)
  zwp_idle_inhibitor_v1* mWaylandInhibitor;
  static bool CheckWaylandIdleInhibitSupport();
  bool InhibitWaylandIdle();
  bool UninhibitWaylandIdle();
#  endif

  static void ReceiveInhibitReply(DBusPendingCall* aPending, void* aUserData);
  void InhibitFailed();
  void InhibitSucceeded(uint32_t aInhibitRequest);

  nsCString mTopic;
  RefPtr mConnection;

  DesktopEnvironment mDesktopEnvironment;

  uint32_t mInhibitRequest;

  bool mShouldInhibit;
  bool mWaitingForReply;
};