Global Metrics

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

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

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

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

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

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

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

path: .metrics.loc.ploc
old: 38.0
new: 52.0

path: .metrics.loc.cloc
old: 40.0
new: 24.0

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

path: .metrics.loc.sloc
old: 88.0
new: 84.0

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

path: .metrics.halstead.N2
old: 69.0
new: 65.0

path: .metrics.halstead.vocabulary
old: 42.0
new: 32.0

path: .metrics.halstead.purity_ratio
old: 1.2940562440606085
new: 0.8779552980284246

path: .metrics.halstead.level
old: 0.07246376811594203
new: 0.07863247863247863

path: .metrics.halstead.effort
old: 10938.855123848994
new: 9601.630434782608

path: .metrics.halstead.length
old: 147.0
new: 151.0

path: .metrics.halstead.bugs
old: 0.16425804855446155
new: 0.15058281189259087

path: .metrics.halstead.difficulty
old: 13.8
new: 12.717391304347826

path: .metrics.halstead.time
old: 607.7141735471664
new: 533.4239130434783

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

path: .metrics.halstead.N1
old: 78.0
new: 86.0

path: .metrics.halstead.n2
old: 30.0
new: 23.0

path: .metrics.halstead.volume
old: 792.6706611484778
new: 755.0

path: .metrics.halstead.estimated_program_length
old: 190.22626787690945
new: 132.57125000229212

path: .metrics.cyclomatic.sum
old: 9.0
new: 15.0

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

path: .metrics.mi.mi_original
old: 61.68502290055126
new: 61.31183556264341

path: .metrics.mi.mi_sei
old: 57.44102171502169
new: 51.11239459521886

path: .metrics.mi.mi_visual_studio
old: 36.07311280733992
new: 35.85487459803708

Spaces Data

Minimal test - lines (14, 82)

path: .spaces[0].metrics.mi.mi_visual_studio
old: null
new: 38.02221403397766

path: .spaces[0].metrics.mi.mi_original
old: null
new: 65.0179859981018

path: .spaces[0].metrics.mi.mi_sei
old: null
new: 54.295277460789706

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

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

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

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

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

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

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

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

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

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

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

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

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

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

path: .spaces[0].metrics.halstead.time
old: 0.0
new: 544.5189447913617

path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 86.0

path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 13.725

path: .spaces[0].metrics.halstead.level
old: null
new: 0.07285974499089254

path: .spaces[0].metrics.halstead.length
old: 1.0
new: 147.0

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

path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 20.0

path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 114.96788691072804

path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 61.0

path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 9801.341006244513

path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 29.0

path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 0.782094468780463

path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.15266368628598898

path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 714.1232062837531

Code

namespace mozilla {

template <>
struct RefPtrTraits {
  static void AddRef(DBusMessage* aMessage) {
    MOZ_ASSERT(aMessage);
    dbus_message_ref(aMessage);
  }
  static void Release(DBusMessage* aMessage) {
    MOZ_ASSERT(aMessage);
    dbus_message_unref(aMessage);
  }
};

template <>
struct RefPtrTraits {
  static void AddRef(DBusPendingCall* aPendingCall) {
    MOZ_ASSERT(aPendingCall);
    dbus_pending_call_ref(aPendingCall);
  }
  static void Release(DBusPendingCall* aPendingCall) {
    MOZ_ASSERT(aPendingCall);
    dbus_pending_call_unref(aPendingCall);
  }
};

/*
 * |RefPtrTraits| specializes |RefPtrTraits<>|
 * for managing |DBusConnection| with |RefPtr|.
 *
 * |RefPtrTraits| will _not_ close the DBus
 * connection upon the final unref. The caller is responsible
 * for closing the connection.
 */
template <>
struct RefPtrTraits {
  static void AddRef(DBusConnection* aConnection) {
    MOZ_ASSERT(aConnection);
    dbus_connection_ref(aConnection);
  }
  static void Release(DBusConnection* aConnection) {
    MOZ_ASSERT(aConnection);
    dbus_connection_unref(aConnection);
  }
};

/*
 * |DBusConnectionDelete| is a deleter for managing instances
 * of |DBusConnection| in |UniquePtr|. Upon destruction, it
 * will close an open connection before unref'ing the data
 * structure.
 *
 * Do not use |UniquePtr| with shared DBus connections. For
 * shared connections, use |RefPtr|.
 */
class DBusConnectionDelete {
 public:
  constexpr DBusConnectionDelete() {}

  void operator()(DBusConnection* aConnection) const {
    MOZ_ASSERT(aConnection);
    if (dbus_connection_get_is_connected(aConnection)) {
      dbus_connection_close(aConnection);
    }
    dbus_connection_unref(aConnection);
  }
};

}  // namespace mozilla