Global Metrics
path: .metrics.halstead.estimated_program_length
old: 1019.3701056018622
new: 2468.3272179789715
path: .metrics.halstead.time
old: 4052.219826512831
new: 128507.93343889323
path: .metrics.halstead.difficulty
old: 16.711111111111112
new: 83.85460992907801
path: .metrics.halstead.N2
old: 282.0
new: 1391.0
path: .metrics.halstead.purity_ratio
old: 1.6904976875652773
new: 0.7430244485186549
path: .metrics.halstead.effort
old: 72939.95687723096
new: 2313142.8019000785
path: .metrics.halstead.N1
old: 321.0
new: 1931.0
path: .metrics.halstead.volume
old: 4364.758057813023
new: 27585.159645444335
path: .metrics.halstead.length
old: 603.0
new: 3322.0
path: .metrics.halstead.n1
old: 16.0
new: 34.0
path: .metrics.halstead.n2
old: 135.0
new: 282.0
path: .metrics.halstead.level
old: 0.05984042553191489
new: 0.011925402799509452
path: .metrics.halstead.bugs
old: 0.5819099011738753
new: 5.830158679651603
path: .metrics.halstead.vocabulary
old: 151.0
new: 316.0
path: .metrics.cyclomatic.sum
old: 22.0
new: 159.0
path: .metrics.cyclomatic.average
old: 1.0
new: 2.484375
path: .metrics.cognitive.sum
old: 0.0
new: 159.0
path: .metrics.cognitive.average
old: 0.0
new: 3.0576923076923075
path: .metrics.mi.mi_sei
old: -0.5031748840962642
new: -79.63511126267085
path: .metrics.mi.mi_visual_studio
old: 22.09788411173413
new: 0.0
path: .metrics.mi.mi_original
old: 37.78738183106536
new: -29.729368533468403
path: .metrics.nexits.average
old: 0.6363636363636364
new: 1.3076923076923077
path: .metrics.nexits.sum
old: 7.0
new: 68.0
path: .metrics.nom.functions
old: 11.0
new: 52.0
path: .metrics.nom.total
old: 11.0
new: 52.0
path: .metrics.nargs.average
old: 1.6363636363636365
new: 2.2884615384615383
path: .metrics.nargs.sum
old: 18.0
new: 119.0
path: .metrics.loc.lloc
old: 13.0
new: 289.0
path: .metrics.loc.sloc
old: 185.0
new: 945.0
path: .metrics.loc.cloc
old: 11.0
new: 88.0
path: .metrics.loc.blank
old: 31.0
new: 134.0
path: .metrics.loc.ploc
old: 143.0
new: 723.0
Spaces Data
Minimal test - lines (36, 116)
path: .spaces[0].metrics.mi.mi_visual_studio
old: null
new: 34.41786410105103
path: .spaces[0].metrics.mi.mi_original
old: null
new: 58.85454761279726
path: .spaces[0].metrics.mi.mi_sei
old: null
new: 32.62576877634166
path: .spaces[0].metrics.nexits.average
old: null
new: 1.2
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 6.0
path: .spaces[0].metrics.halstead.length
old: 1.0
new: 241.0
path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 29552.647893372057
path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 1417.7169748962035
path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 295.9642000579637
path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.2280672201575258
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 42.0
path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.31862242955498615
path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 59.0
path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 20.845238095238095
path: .spaces[0].metrics.halstead.n1
old: 0.0
new: 17.0
path: .spaces[0].metrics.halstead.time
old: 0.0
new: 1641.813771854003
path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 138.0
path: .spaces[0].metrics.halstead.level
old: null
new: 0.047972587093089665
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 103.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 5.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 5.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 23.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 65.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 7.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 9.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 81.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 2.4
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 12.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.3333333333333335
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 14.0
path: .spaces[0].metrics.nargs.average
old: null
new: 0.4
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0
Code
class nsInputStreamReadyEvent final : public CancelableRunnable,
public nsIInputStreamCallback,
public nsIRunnablePriority {
public:
NS_DECL_ISUPPORTS_INHERITED
nsInputStreamReadyEvent(const char* aName, nsIInputStreamCallback* aCallback,
nsIEventTarget* aTarget, uint32_t aPriority)
: CancelableRunnable(aName),
mCallback(aCallback),
mTarget(aTarget),
mPriority(aPriority) {}
private:
~nsInputStreamReadyEvent() {
if (!mCallback) {
return;
}
//
// whoa!! looks like we never posted this event. take care to
// release mCallback on the correct thread. if mTarget lives on the
// calling thread, then we are ok. otherwise, we have to try to
// proxy the Release over the right thread. if that thread is dead,
// then there's nothing we can do... better to leak than crash.
//
bool val;
nsresult rv = mTarget->IsOnCurrentThread(&val);
if (NS_FAILED(rv) || !val) {
nsCOMPtr event = NS_NewInputStreamReadyEvent(
"~nsInputStreamReadyEvent", mCallback, mTarget, mPriority);
mCallback = nullptr;
if (event) {
rv = event->OnInputStreamReady(nullptr);
if (NS_FAILED(rv)) {
MOZ_ASSERT_UNREACHABLE("leaking stream event");
nsISupports* sup = event;
NS_ADDREF(sup);
}
}
}
}
public:
NS_IMETHOD OnInputStreamReady(nsIAsyncInputStream* aStream) override {
mStream = aStream;
nsresult rv = mTarget->Dispatch(this, NS_DISPATCH_NORMAL);
if (NS_FAILED(rv)) {
NS_WARNING("Dispatch failed");
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHOD Run() override {
if (mCallback) {
if (mStream) {
mCallback->OnInputStreamReady(mStream);
}
mCallback = nullptr;
}
return NS_OK;
}
nsresult Cancel() override {
mCallback = nullptr;
return NS_OK;
}
NS_IMETHOD GetPriority(uint32_t* aPriority) override {
*aPriority = mPriority;
return NS_OK;
}
private:
nsCOMPtr mStream;
nsCOMPtr mCallback;
nsCOMPtr mTarget;
uint32_t mPriority;
};
Minimal test - lines (126, 198)
path: .spaces[1].metrics.nargs.sum
old: 18.0
new: 1.0
path: .spaces[1].metrics.nargs.average
old: 1.6363636363636365
new: 0.25
path: .spaces[1].metrics.nom.total
old: 11.0
new: 4.0
path: .spaces[1].metrics.nom.functions
old: 11.0
new: 4.0
path: .spaces[1].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 12.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 2.6
path: .spaces[1].metrics.cyclomatic.sum
old: 20.0
new: 13.0
path: .spaces[1].metrics.mi.mi_original
old: 40.9348904646819
new: 61.699343606163424
path: .spaces[1].metrics.mi.mi_visual_studio
old: 23.93853243548649
new: 36.08148748898446
path: .spaces[1].metrics.mi.mi_sei
old: -2.4452480243893984
new: 37.71294705215013
path: .spaces[1].metrics.loc.ploc
old: 127.0
new: 58.0
path: .spaces[1].metrics.loc.blank
old: 28.0
new: 8.0
path: .spaces[1].metrics.loc.lloc
old: 13.0
new: 21.0
path: .spaces[1].metrics.loc.cloc
old: 4.0
new: 7.0
path: .spaces[1].metrics.loc.sloc
old: 159.0
new: 73.0
path: .spaces[1].metrics.halstead.n2
old: 122.0
new: 37.0
path: .spaces[1].metrics.halstead.time
old: 4058.695554048764
new: 1346.6004706451242
path: .spaces[1].metrics.halstead.length
old: 587.0
new: 206.0
path: .spaces[1].metrics.halstead.volume
old: 4172.703856128785
new: 1185.5068254456744
path: .spaces[1].metrics.halstead.estimated_program_length
old: 909.5499551826722
new: 262.23664282952694
path: .spaces[1].metrics.halstead.bugs
old: 0.5825296910140582
new: 0.27918125591908
path: .spaces[1].metrics.halstead.vocabulary
old: 138.0
new: 54.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.549488850396375
new: 1.2729934117938202
path: .spaces[1].metrics.halstead.difficulty
old: 17.508196721311474
new: 20.445945945945947
path: .spaces[1].metrics.halstead.effort
old: 73056.51997287775
new: 24238.808471612236
path: .spaces[1].metrics.halstead.level
old: 0.05711610486891386
new: 0.048909451421017845
path: .spaces[1].metrics.halstead.n1
old: 16.0
new: 17.0
path: .spaces[1].metrics.halstead.N1
old: 320.0
new: 117.0
path: .spaces[1].metrics.halstead.N2
old: 267.0
new: 89.0
path: .spaces[1].metrics.nexits.average
old: 0.6363636363636364
new: 1.25
path: .spaces[1].metrics.nexits.sum
old: 7.0
new: 5.0
Code
class nsOutputStreamReadyEvent final : public CancelableRunnable,
public nsIOutputStreamCallback {
public:
NS_DECL_ISUPPORTS_INHERITED
nsOutputStreamReadyEvent(nsIOutputStreamCallback* aCallback,
nsIEventTarget* aTarget)
: CancelableRunnable("nsOutputStreamReadyEvent"),
mCallback(aCallback),
mTarget(aTarget) {}
private:
~nsOutputStreamReadyEvent() {
if (!mCallback) {
return;
}
//
// whoa!! looks like we never posted this event. take care to
// release mCallback on the correct thread. if mTarget lives on the
// calling thread, then we are ok. otherwise, we have to try to
// proxy the Release over the right thread. if that thread is dead,
// then there's nothing we can do... better to leak than crash.
//
bool val;
nsresult rv = mTarget->IsOnCurrentThread(&val);
if (NS_FAILED(rv) || !val) {
nsCOMPtr event =
NS_NewOutputStreamReadyEvent(mCallback, mTarget);
mCallback = nullptr;
if (event) {
rv = event->OnOutputStreamReady(nullptr);
if (NS_FAILED(rv)) {
MOZ_ASSERT_UNREACHABLE("leaking stream event");
nsISupports* sup = event;
NS_ADDREF(sup);
}
}
}
}
public:
NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream* aStream) override {
mStream = aStream;
nsresult rv = mTarget->Dispatch(this, NS_DISPATCH_NORMAL);
if (NS_FAILED(rv)) {
NS_WARNING("PostEvent failed");
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHOD Run() override {
if (mCallback) {
if (mStream) {
mCallback->OnOutputStreamReady(mStream);
}
mCallback = nullptr;
}
return NS_OK;
}
nsresult Cancel() override {
mCallback = nullptr;
return NS_OK;
}
private:
nsCOMPtr mStream;
nsCOMPtr mCallback;
nsCOMPtr mTarget;
};
Minimal test - lines (138, 164)
path: .spaces[1].spaces[0].metrics.nom.total
old: 11.0
new: 1.0
path: .spaces[1].spaces[0].metrics.nom.functions
old: 11.0
new: 1.0
path: .spaces[1].spaces[0].metrics.cognitive.sum
old: 0.0
new: 8.0
path: .spaces[1].spaces[0].metrics.cognitive.average
old: 0.0
new: 8.0
path: .spaces[1].spaces[0].metrics.loc.sloc
old: 157.0
new: 27.0
path: .spaces[1].spaces[0].metrics.loc.lloc
old: 13.0
new: 9.0
path: .spaces[1].spaces[0].metrics.loc.blank
old: 29.0
new: 0.0
path: .spaces[1].spaces[0].metrics.loc.cloc
old: 3.0
new: 7.0
path: .spaces[1].spaces[0].metrics.loc.ploc
old: 125.0
new: 20.0
path: .spaces[1].spaces[0].metrics.halstead.difficulty
old: 17.58677685950413
new: 13.894736842105264
path: .spaces[1].spaces[0].metrics.halstead.volume
old: 4152.348768531908
new: 415.4719243725423
path: .spaces[1].spaces[0].metrics.halstead.level
old: 0.056860902255639105
new: 0.07196969696969696
path: .spaces[1].spaces[0].metrics.halstead.length
old: 585.0
new: 81.0
path: .spaces[1].spaces[0].metrics.halstead.bugs
old: 0.5823697346173732
new: 0.10726879868086708
path: .spaces[1].spaces[0].metrics.halstead.vocabulary
old: 137.0
new: 35.0
path: .spaces[1].spaces[0].metrics.halstead.effort
old: 73026.43123500743
new: 5772.873054439535
path: .spaces[1].spaces[0].metrics.halstead.time
old: 4057.023957500413
new: 320.7151696910853
path: .spaces[1].spaces[0].metrics.halstead.estimated_program_length
old: 901.182451710226
new: 144.71062275542812
path: .spaces[1].spaces[0].metrics.halstead.n2
old: 121.0
new: 19.0
path: .spaces[1].spaces[0].metrics.halstead.N2
old: 266.0
new: 33.0
path: .spaces[1].spaces[0].metrics.halstead.N1
old: 319.0
new: 48.0
path: .spaces[1].spaces[0].metrics.halstead.purity_ratio
old: 1.5404828234362835
new: 1.786550898215162
path: .spaces[1].spaces[0].metrics.nargs.average
old: 1.6363636363636365
new: 0.0
path: .spaces[1].spaces[0].metrics.nargs.sum
old: 18.0
new: 0.0
path: .spaces[1].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 6.0
path: .spaces[1].spaces[0].metrics.cyclomatic.sum
old: 19.0
new: 6.0
path: .spaces[1].spaces[0].metrics.nexits.average
old: 0.6363636363636364
new: 1.0
path: .spaces[1].spaces[0].metrics.nexits.sum
old: 7.0
new: 1.0
path: .spaces[1].spaces[0].metrics.mi.mi_visual_studio
old: 24.207827463063225
new: 49.63420149469298
path: .spaces[1].spaces[0].metrics.mi.mi_original
old: 41.39538496183812
new: 84.874484555925
path: .spaces[1].spaces[0].metrics.mi.mi_sei
old: -3.419551906741175
new: 82.83384728813864
Code
~nsOutputStreamReadyEvent() {
if (!mCallback) {
return;
}
//
// whoa!! looks like we never posted this event. take care to
// release mCallback on the correct thread. if mTarget lives on the
// calling thread, then we are ok. otherwise, we have to try to
// proxy the Release over the right thread. if that thread is dead,
// then there's nothing we can do... better to leak than crash.
//
bool val;
nsresult rv = mTarget->IsOnCurrentThread(&val);
if (NS_FAILED(rv) || !val) {
nsCOMPtr event =
NS_NewOutputStreamReadyEvent(mCallback, mTarget);
mCallback = nullptr;
if (event) {
rv = event->OnOutputStreamReady(nullptr);
if (NS_FAILED(rv)) {
MOZ_ASSERT_UNREACHABLE("leaking stream event");
nsISupports* sup = event;
NS_ADDREF(sup);
}
}
}
}