Global Metrics
path: .metrics.cognitive.sum
old: 101.0
new: 5.0
path: .metrics.cognitive.average
old: 3.607142857142857
new: 0.5
path: .metrics.nargs.average
old: 1.3928571428571428
new: 1.1
path: .metrics.nargs.sum
old: 39.0
new: 11.0
path: .metrics.cyclomatic.sum
old: 109.0
new: 19.0
path: .metrics.cyclomatic.average
old: 3.6333333333333337
new: 1.3571428571428572
path: .metrics.loc.lloc
old: 174.0
new: 26.0
path: .metrics.loc.ploc
old: 319.0
new: 93.0
path: .metrics.loc.blank
old: 56.0
new: 27.0
path: .metrics.loc.cloc
old: 38.0
new: 35.0
path: .metrics.loc.sloc
old: 413.0
new: 155.0
path: .metrics.nom.total
old: 28.0
new: 10.0
path: .metrics.nom.functions
old: 28.0
new: 10.0
path: .metrics.nexits.average
old: 2.0357142857142856
new: 0.7
path: .metrics.nexits.sum
old: 57.0
new: 7.0
path: .metrics.mi.mi_visual_studio
old: 0.0
new: 26.197767114915376
path: .metrics.mi.mi_sei
old: -43.414715661562255
new: 24.43630052024362
path: .metrics.mi.mi_original
old: -1.0070750520263942
new: 44.798181766505294
path: .metrics.halstead.estimated_program_length
old: 1432.5701957459207
new: 517.3426682402605
path: .metrics.halstead.level
old: 0.014705882352941176
new: 0.04949459742070408
path: .metrics.halstead.length
old: 1727.0
new: 346.0
path: .metrics.halstead.n2
old: 170.0
new: 71.0
path: .metrics.halstead.time
old: 50056.60791443136
new: 2521.241698179172
path: .metrics.halstead.bugs
old: 3.1095773163343776
new: 0.4241017548435197
path: .metrics.halstead.difficulty
old: 68.0
new: 20.204225352112676
path: .metrics.halstead.vocabulary
old: 204.0
new: 90.0
path: .metrics.halstead.volume
old: 13250.278565584773
new: 2246.1811713300676
path: .metrics.halstead.n1
old: 34.0
new: 19.0
path: .metrics.halstead.N2
old: 680.0
new: 151.0
path: .metrics.halstead.N1
old: 1047.0
new: 195.0
path: .metrics.halstead.effort
old: 901018.9424597644
new: 45382.3505672251
path: .metrics.halstead.purity_ratio
old: 0.8295137207561788
new: 1.495210023815782
Spaces Data
Minimal test - lines (72, 87)
path: .spaces[0].spaces[2].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[0].spaces[2].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[0].spaces[2].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[0].spaces[2].metrics.loc.ploc
old: 4.0
new: 12.0
path: .spaces[0].spaces[2].metrics.loc.lloc
old: 3.0
new: 5.0
path: .spaces[0].spaces[2].metrics.loc.sloc
old: 4.0
new: 16.0
path: .spaces[0].spaces[2].metrics.mi.mi_original
old: 125.96700005047744
new: 97.44600592376068
path: .spaces[0].spaces[2].metrics.mi.mi_visual_studio
old: 73.66491231022073
new: 56.98596837646822
path: .spaces[0].spaces[2].metrics.mi.mi_sei
old: 106.23475401527978
new: 96.16909822706718
path: .spaces[0].spaces[2].metrics.halstead.difficulty
old: 5.6
new: 6.875
path: .spaces[0].spaces[2].metrics.halstead.vocabulary
old: 13.0
new: 26.0
path: .spaces[0].spaces[2].metrics.halstead.N2
old: 7.0
new: 22.0
path: .spaces[0].spaces[2].metrics.halstead.level
old: 0.17857142857142858
new: 0.14545454545454545
path: .spaces[0].spaces[2].metrics.halstead.time
old: 21.873710333900675
new: 86.17472816592003
path: .spaces[0].spaces[2].metrics.halstead.n2
old: 5.0
new: 16.0
path: .spaces[0].spaces[2].metrics.halstead.length
old: 19.0
new: 48.0
path: .spaces[0].spaces[2].metrics.halstead.purity_ratio
old: 1.8741916039177269
new: 2.025401686434867
path: .spaces[0].spaces[2].metrics.halstead.volume
old: 70.30835464468075
new: 225.6211064707724
path: .spaces[0].spaces[2].metrics.halstead.effort
old: 393.72678601021215
new: 1551.1451069865604
path: .spaces[0].spaces[2].metrics.halstead.N1
old: 12.0
new: 26.0
path: .spaces[0].spaces[2].metrics.halstead.n1
old: 8.0
new: 10.0
path: .spaces[0].spaces[2].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 97.21928094887365
path: .spaces[0].spaces[2].metrics.halstead.bugs
old: 0.01790641806124263
new: 0.0446663395865281
path: .spaces[0].spaces[2].metrics.nargs.sum
old: 1.0
new: 2.0
path: .spaces[0].spaces[2].metrics.nargs.average
old: 1.0
new: 2.0
Code
MessageLoopIdleTask::MessageLoopIdleTask(nsIRunnable* aTask,
uint32_t aEnsureRunsAfterMS)
: mozilla::Runnable("MessageLoopIdleTask"), mTask(aTask) {
// Init() really shouldn't fail, but if it does, we schedule our runnable
// immediately, because it's more important to guarantee that we run the task
// eventually than it is to run the task when we're idle.
nsresult rv = Init(aEnsureRunsAfterMS);
if (NS_FAILED(rv)) {
NS_WARNING(
"Running idle task early because we couldn't initialize our timer.");
NS_DispatchToCurrentThread(mTask);
mTask = nullptr;
mTimer = nullptr;
}
}
Minimal test - lines (30, 42)
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 37.93407072071062
new: 70.42470269639229
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 45.81419263195568
new: 59.14933563923017
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 78.34226940064421
new: 101.1453639430836
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 27.0
new: 10.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 16.0
new: 0.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 8.0
new: 3.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 35.0
new: 13.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.132930582297863
new: 0.04789578435685381
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 7963.779793270693
new: 1722.375411004557
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 650.1044729200565
new: 211.51978731634912
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 13.0
new: 12.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.3846922683536795
new: 2.1405004203880074
path: .spaces[0].spaces[0].metrics.halstead.length
old: 123.0
new: 45.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 442.4322107372607
new: 95.6875228335865
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 170.3171490075026
new: 96.32251891746031
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.08163265306122448
new: 0.12280701754385966
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 39.0
new: 26.0
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 26.0
new: 14.0
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 74.0
new: 26.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 49.0
new: 19.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 12.25
new: 8.142857142857142
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 6.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 6.0
new: 2.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 5.0
new: 0.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 5.0
new: 0.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 6.0
new: 0.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 6.0
new: 0.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 2.0
new: 0.0
Code
class MessageLoopIdleTask : public Runnable, public SupportsWeakPtr {
public:
MessageLoopIdleTask(nsIRunnable* aTask, uint32_t aEnsureRunsAfterMS);
NS_IMETHOD Run() override;
private:
nsresult Init(uint32_t aEnsureRunsAfterMS);
nsCOMPtr mTask;
nsCOMPtr mTimer;
virtual ~MessageLoopIdleTask() = default;
};
Minimal test - lines (20, 133)
path: .spaces[0].metrics.nom.total
old: 28.0
new: 8.0
path: .spaces[0].metrics.nom.functions
old: 28.0
new: 8.0
path: .spaces[0].metrics.cognitive.sum
old: 101.0
new: 4.0
path: .spaces[0].metrics.cognitive.average
old: 3.607142857142857
new: 0.5
path: .spaces[0].metrics.nargs.average
old: 1.3928571428571428
new: 0.75
path: .spaces[0].metrics.nargs.sum
old: 39.0
new: 6.0
path: .spaces[0].metrics.nexits.average
old: 2.0357142857142856
new: 0.5
path: .spaces[0].metrics.nexits.sum
old: 57.0
new: 4.0
path: .spaces[0].metrics.halstead.level
old: 0.014444831186912636
new: 0.04411027568922306
path: .spaces[0].metrics.halstead.volume
old: 13170.36421498185
new: 1488.3427009514792
path: .spaces[0].metrics.halstead.estimated_program_length
old: 1397.230282206101
new: 320.9256139754692
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.8109287766721422
new: 1.2888578874516836
path: .spaces[0].metrics.halstead.N1
old: 1047.0
new: 144.0
path: .spaces[0].metrics.halstead.length
old: 1723.0
new: 249.0
path: .spaces[0].metrics.halstead.effort
old: 911770.03348537
new: 33741.40554997956
path: .spaces[0].metrics.halstead.bugs
old: 3.134264340265713
new: 0.34806006089648583
path: .spaces[0].metrics.halstead.N2
old: 676.0
new: 105.0
path: .spaces[0].metrics.halstead.n2
old: 166.0
new: 44.0
path: .spaces[0].metrics.halstead.time
old: 50653.89074918722
new: 1874.52253055442
path: .spaces[0].metrics.halstead.difficulty
old: 69.2289156626506
new: 22.670454545454547
path: .spaces[0].metrics.halstead.n1
old: 34.0
new: 19.0
path: .spaces[0].metrics.halstead.vocabulary
old: 200.0
new: 63.0
path: .spaces[0].metrics.loc.sloc
old: 388.0
new: 114.0
path: .spaces[0].metrics.loc.blank
old: 55.0
new: 21.0
path: .spaces[0].metrics.loc.ploc
old: 306.0
new: 66.0
path: .spaces[0].metrics.loc.lloc
old: 174.0
new: 20.0
path: .spaces[0].metrics.cyclomatic.average
old: 3.724137931034482
new: 1.3636363636363635
path: .spaces[0].metrics.cyclomatic.sum
old: 108.0
new: 15.0
path: .spaces[0].metrics.mi.mi_sei
old: -44.45121567986864
new: 36.277536086252795
path: .spaces[0].metrics.mi.mi_original
old: 0.2659463619974787
new: 52.83540894300303
path: .spaces[0].metrics.mi.mi_visual_studio
old: 0.1555241883026191
new: 30.89789996666844
Code
namespace {
/**
* This Task runs its nsIRunnable when Run() is called, or after
* aEnsureRunsAfterMS milliseconds have elapsed since the object was
* constructed.
*
* Note that the MessageLoop owns this object and will delete it after it calls
* Run(). Tread lightly.
*/
class MessageLoopIdleTask : public Runnable, public SupportsWeakPtr {
public:
MessageLoopIdleTask(nsIRunnable* aTask, uint32_t aEnsureRunsAfterMS);
NS_IMETHOD Run() override;
private:
nsresult Init(uint32_t aEnsureRunsAfterMS);
nsCOMPtr mTask;
nsCOMPtr mTimer;
virtual ~MessageLoopIdleTask() = default;
};
/**
* This timer callback calls MessageLoopIdleTask::Run() when its timer fires.
* (The timer can't call back into MessageLoopIdleTask directly since that's
* not a refcounted object; it's owned by the MessageLoop.)
*
* We keep a weak reference to the MessageLoopIdleTask, although a raw pointer
* should in theory suffice: When the MessageLoopIdleTask runs (right before
* the MessageLoop deletes it), it cancels its timer. But the weak pointer
* saves us from worrying about an edge case somehow messing us up here.
*/
class MessageLoopTimerCallback : public nsITimerCallback, public nsINamed {
public:
explicit MessageLoopTimerCallback(MessageLoopIdleTask* aTask);
NS_DECL_ISUPPORTS
NS_DECL_NSITIMERCALLBACK
NS_IMETHOD GetName(nsACString& aName) override {
aName.AssignLiteral("MessageLoopTimerCallback");
return NS_OK;
}
private:
WeakPtr mTask;
virtual ~MessageLoopTimerCallback() = default;
};
MessageLoopIdleTask::MessageLoopIdleTask(nsIRunnable* aTask,
uint32_t aEnsureRunsAfterMS)
: mozilla::Runnable("MessageLoopIdleTask"), mTask(aTask) {
// Init() really shouldn't fail, but if it does, we schedule our runnable
// immediately, because it's more important to guarantee that we run the task
// eventually than it is to run the task when we're idle.
nsresult rv = Init(aEnsureRunsAfterMS);
if (NS_FAILED(rv)) {
NS_WARNING(
"Running idle task early because we couldn't initialize our timer.");
NS_DispatchToCurrentThread(mTask);
mTask = nullptr;
mTimer = nullptr;
}
}
nsresult MessageLoopIdleTask::Init(uint32_t aEnsureRunsAfterMS) {
RefPtr callback =
new MessageLoopTimerCallback(this);
return NS_NewTimerWithCallback(getter_AddRefs(mTimer), callback,
aEnsureRunsAfterMS, nsITimer::TYPE_ONE_SHOT);
}
NS_IMETHODIMP
MessageLoopIdleTask::Run() {
// Null out our pointers because if Run() was called by the timer, this
// object will be kept alive by the MessageLoop until the MessageLoop calls
// Run().
if (mTimer) {
mTimer->Cancel();
mTimer = nullptr;
}
if (mTask) {
mTask->Run();
mTask = nullptr;
}
return NS_OK;
}
MessageLoopTimerCallback::MessageLoopTimerCallback(MessageLoopIdleTask* aTask)
: mTask(aTask) {}
NS_IMETHODIMP
MessageLoopTimerCallback::Notify(nsITimer* aTimer) {
// We don't expect to hit the case when the timer fires but mTask has been
// deleted, because mTask should cancel the timer before the mTask is
// deleted. But you never know...
NS_WARNING_ASSERTION(mTask, "This timer shouldn't have fired.");
if (mTask) {
mTask->Run();
}
return NS_OK;
}
NS_IMPL_ISUPPORTS(MessageLoopTimerCallback, nsITimerCallback, nsINamed)
} // namespace
Minimal test - lines (54, 70)
path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 103.9368027391656
new: 96.34596848081097
path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 60.78175598781615
new: 56.342671626205245
path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 74.45189760444485
new: 63.60245852311101
path: .spaces[0].spaces[1].metrics.cyclomatic.average
old: 2.0
new: 1.0
path: .spaces[0].spaces[1].metrics.cyclomatic.sum
old: 2.0
new: 3.0
path: .spaces[0].spaces[1].metrics.loc.lloc
old: 4.0
new: 2.0
path: .spaces[0].spaces[1].metrics.loc.sloc
old: 11.0
new: 17.0
path: .spaces[0].spaces[1].metrics.loc.ploc
old: 9.0
new: 13.0
path: .spaces[0].spaces[1].metrics.loc.blank
old: 2.0
new: 4.0
path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.05366919014034088
new: 0.051708670684284946
path: .spaces[0].spaces[1].metrics.halstead.N1
old: 28.0
new: 25.0
path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 81.07329781366414
new: 117.30296890880646
path: .spaces[0].spaces[1].metrics.halstead.length
old: 46.0
new: 45.0
path: .spaces[0].spaces[1].metrics.halstead.n2
old: 11.0
new: 16.0
path: .spaces[0].spaces[1].metrics.halstead.effort
old: 2043.0050725173855
new: 1932.0881720208545
path: .spaces[0].spaces[1].metrics.halstead.N2
old: 18.0
new: 20.0
path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.10185185185185185
new: 0.11428571428571428
path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.7624629959492204
new: 2.6067326424179216
path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 23.0
new: 30.0
path: .spaces[0].spaces[1].metrics.halstead.n1
old: 12.0
new: 14.0
path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 9.818181818181818
new: 8.75
path: .spaces[0].spaces[1].metrics.halstead.volume
old: 208.0838499786226
new: 220.81007680238335
path: .spaces[0].spaces[1].metrics.halstead.time
old: 113.5002818065214
new: 107.33823177893636
path: .spaces[0].spaces[1].metrics.nargs.average
old: 1.0
new: 0.5
path: .spaces[0].spaces[1].metrics.nexits.average
old: 2.0
new: 0.5
path: .spaces[0].spaces[1].metrics.nexits.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[1].metrics.nom.functions
old: 1.0
new: 2.0
path: .spaces[0].spaces[1].metrics.nom.total
old: 1.0
new: 2.0
path: .spaces[0].spaces[1].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[1].metrics.cognitive.average
old: 1.0
new: 0.0
Code
class MessageLoopTimerCallback : public nsITimerCallback, public nsINamed {
public:
explicit MessageLoopTimerCallback(MessageLoopIdleTask* aTask);
NS_DECL_ISUPPORTS
NS_DECL_NSITIMERCALLBACK
NS_IMETHOD GetName(nsACString& aName) override {
aName.AssignLiteral("MessageLoopTimerCallback");
return NS_OK;
}
private:
WeakPtr mTask;
virtual ~MessageLoopTimerCallback() = default;
};
Minimal test - lines (97, 113)
path: .spaces[0].spaces[4].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[0].spaces[4].metrics.loc.ploc
old: 14.0
new: 11.0
path: .spaces[0].spaces[4].metrics.loc.sloc
old: 14.0
new: 17.0
path: .spaces[0].spaces[4].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[0].spaces[4].metrics.cognitive.sum
old: 3.0
new: 2.0
path: .spaces[0].spaces[4].metrics.cognitive.average
old: 3.0
new: 2.0
path: .spaces[0].spaces[4].metrics.halstead.n2
old: 21.0
new: 6.0
path: .spaces[0].spaces[4].metrics.halstead.volume
old: 381.55971309377543
new: 125.64271242790092
path: .spaces[0].spaces[4].metrics.halstead.bugs
old: 0.08087540114591991
new: 0.033447495628517385
path: .spaces[0].spaces[4].metrics.halstead.N2
old: 32.0
new: 12.0
path: .spaces[0].spaces[4].metrics.halstead.estimated_program_length
old: 140.34438221418816
new: 39.50977500432694
path: .spaces[0].spaces[4].metrics.halstead.effort
old: 3779.258110643109
new: 1005.1416994232076
path: .spaces[0].spaces[4].metrics.halstead.length
old: 75.0
new: 33.0
path: .spaces[0].spaces[4].metrics.halstead.level
old: 0.10096153846153846
new: 0.125
path: .spaces[0].spaces[4].metrics.halstead.n1
old: 13.0
new: 8.0
path: .spaces[0].spaces[4].metrics.halstead.time
old: 209.95878392461717
new: 55.841205523511526
path: .spaces[0].spaces[4].metrics.halstead.vocabulary
old: 34.0
new: 14.0
path: .spaces[0].spaces[4].metrics.halstead.purity_ratio
old: 1.8712584295225088
new: 1.1972659092220286
path: .spaces[0].spaces[4].metrics.halstead.N1
old: 43.0
new: 21.0
path: .spaces[0].spaces[4].metrics.halstead.difficulty
old: 9.904761904761903
new: 8.0
path: .spaces[0].spaces[4].metrics.mi.mi_original
old: 96.64708098642733
new: 99.27804405699666
path: .spaces[0].spaces[4].metrics.mi.mi_sei
old: 64.03687204171334
new: 98.1233602039635
path: .spaces[0].spaces[4].metrics.mi.mi_visual_studio
old: 56.51876081077621
new: 58.057335705846
path: .spaces[0].spaces[4].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[4].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[0].spaces[4].metrics.nexits.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[4].metrics.nexits.average
old: 2.0
new: 1.0
Code
MessageLoopIdleTask::Run() {
// Null out our pointers because if Run() was called by the timer, this
// object will be kept alive by the MessageLoop until the MessageLoop calls
// Run().
if (mTimer) {
mTimer->Cancel();
mTimer = nullptr;
}
if (mTask) {
mTask->Run();
mTask = nullptr;
}
return NS_OK;
}
Minimal test - lines (115, 116)
path: .spaces[0].spaces[5].metrics.cognitive.sum
old: 20.0
new: 0.0
path: .spaces[0].spaces[5].metrics.cognitive.average
old: 20.0
new: 0.0
path: .spaces[0].spaces[5].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[0].spaces[5].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.bugs
old: 0.42436522748983424
new: 0.007604544540941429
path: .spaces[0].spaces[5].metrics.halstead.vocabulary
old: 68.0
new: 9.0
path: .spaces[0].spaces[5].metrics.halstead.n1
old: 26.0
new: 5.0
path: .spaces[0].spaces[5].metrics.halstead.n2
old: 42.0
new: 4.0
path: .spaces[0].spaces[5].metrics.halstead.purity_ratio
old: 1.4174340017413671
new: 1.7826945885851644
path: .spaces[0].spaces[5].metrics.halstead.difficulty
old: 30.333333333333332
new: 3.125
path: .spaces[0].spaces[5].metrics.halstead.length
old: 246.0
new: 11.0
path: .spaces[0].spaces[5].metrics.halstead.N1
old: 148.0
new: 6.0
path: .spaces[0].spaces[5].metrics.halstead.volume
old: 1497.5158589475834
new: 34.86917501586544
path: .spaces[0].spaces[5].metrics.halstead.time
old: 2523.591540078335
new: 6.053676218032194
path: .spaces[0].spaces[5].metrics.halstead.level
old: 0.03296703296703297
new: 0.32
path: .spaces[0].spaces[5].metrics.halstead.estimated_program_length
old: 348.6887644283763
new: 19.60964047443681
path: .spaces[0].spaces[5].metrics.halstead.N2
old: 98.0
new: 5.0
path: .spaces[0].spaces[5].metrics.halstead.effort
old: 45424.64772141003
new: 108.9661719245795
path: .spaces[0].spaces[5].metrics.nargs.average
old: 4.0
new: 1.0
path: .spaces[0].spaces[5].metrics.nargs.sum
old: 4.0
new: 1.0
path: .spaces[0].spaces[5].metrics.cyclomatic.average
old: 18.0
new: 1.0
path: .spaces[0].spaces[5].metrics.cyclomatic.sum
old: 18.0
new: 1.0
path: .spaces[0].spaces[5].metrics.loc.lloc
old: 23.0
new: 0.0
path: .spaces[0].spaces[5].metrics.loc.sloc
old: 48.0
new: 2.0
path: .spaces[0].spaces[5].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[0].spaces[5].metrics.loc.ploc
old: 39.0
new: 2.0
path: .spaces[0].spaces[5].metrics.loc.blank
old: 8.0
new: 0.0
path: .spaces[0].spaces[5].metrics.mi.mi_visual_studio
old: 38.67041896969032
new: 82.49864270575097
path: .spaces[0].spaces[5].metrics.mi.mi_original
old: 66.12641643817045
new: 141.07267902683415
path: .spaces[0].spaces[5].metrics.mi.mi_sei
old: 32.61956157946088
new: 127.92582230432583
Code
MessageLoopTimerCallback::MessageLoopTimerCallback(MessageLoopIdleTask* aTask)
: mTask(aTask) {}
Minimal test - lines (89, 94)
path: .spaces[0].spaces[3].metrics.cognitive.average
old: 1.0
new: 0.0
path: .spaces[0].spaces[3].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[3].metrics.halstead.length
old: 46.0
new: 31.0
path: .spaces[0].spaces[3].metrics.halstead.purity_ratio
old: 1.8730318291487928
new: 2.2991299598027064
path: .spaces[0].spaces[3].metrics.halstead.effort
old: 2367.92472423608
new: 973.5571567589122
path: .spaces[0].spaces[3].metrics.halstead.estimated_program_length
old: 86.15946414084446
new: 71.27302875388389
path: .spaces[0].spaces[3].metrics.halstead.N1
old: 27.0
new: 18.0
path: .spaces[0].spaces[3].metrics.halstead.bugs
old: 0.05921849147793715
new: 0.03274309396303406
path: .spaces[0].spaces[3].metrics.halstead.difficulty
old: 11.227272727272728
new: 7.15
path: .spaces[0].spaces[3].metrics.halstead.level
old: 0.08906882591093118
new: 0.13986013986013984
path: .spaces[0].spaces[3].metrics.halstead.n1
old: 13.0
new: 11.0
path: .spaces[0].spaces[3].metrics.halstead.n2
old: 11.0
new: 10.0
path: .spaces[0].spaces[3].metrics.halstead.vocabulary
old: 24.0
new: 21.0
path: .spaces[0].spaces[3].metrics.halstead.volume
old: 210.90827503317317
new: 136.16184010614157
path: .spaces[0].spaces[3].metrics.halstead.N2
old: 19.0
new: 13.0
path: .spaces[0].spaces[3].metrics.halstead.time
old: 131.55137356867112
new: 54.08650870882846
path: .spaces[0].spaces[3].metrics.loc.lloc
old: 4.0
new: 1.0
path: .spaces[0].spaces[3].metrics.mi.mi_visual_studio
old: 66.48309667627105
new: 67.94824963015566
path: .spaces[0].spaces[3].metrics.mi.mi_sei
old: 88.51715365783039
new: 92.0298786186454
path: .spaces[0].spaces[3].metrics.mi.mi_original
old: 113.68609531642348
new: 116.19150686756618
path: .spaces[0].spaces[3].metrics.nexits.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[3].metrics.nexits.average
old: 2.0
new: 1.0
path: .spaces[0].spaces[3].metrics.cyclomatic.average
old: 2.0
new: 1.0
path: .spaces[0].spaces[3].metrics.cyclomatic.sum
old: 2.0
new: 1.0
Code
nsresult MessageLoopIdleTask::Init(uint32_t aEnsureRunsAfterMS) {
RefPtr callback =
new MessageLoopTimerCallback(this);
return NS_NewTimerWithCallback(getter_AddRefs(mTimer), callback,
aEnsureRunsAfterMS, nsITimer::TYPE_ONE_SHOT);
}
Minimal test - lines (119, 129)
path: .spaces[0].spaces[6].metrics.cognitive.sum
old: 14.0
new: 1.0
path: .spaces[0].spaces[6].metrics.cognitive.average
old: 14.0
new: 1.0
path: .spaces[0].spaces[6].metrics.mi.mi_visual_studio
old: 39.3046583652914
new: 62.944289576314766
path: .spaces[0].spaces[6].metrics.mi.mi_sei
old: 43.59861067684025
new: 115.9681268074996
path: .spaces[0].spaces[6].metrics.mi.mi_original
old: 67.2109658046483
new: 107.63473517549824
path: .spaces[0].spaces[6].metrics.nexits.average
old: 2.0
new: 1.0
path: .spaces[0].spaces[6].metrics.nexits.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[6].metrics.nargs.average
old: 4.0
new: 1.0
path: .spaces[0].spaces[6].metrics.nargs.sum
old: 4.0
new: 1.0
path: .spaces[0].spaces[6].metrics.halstead.effort
old: 35911.27326133506
new: 574.799462050829
path: .spaces[0].spaces[6].metrics.halstead.vocabulary
old: 59.0
new: 17.0
path: .spaces[0].spaces[6].metrics.halstead.purity_ratio
old: 1.179714711424899
new: 2.1011730005192324
path: .spaces[0].spaces[6].metrics.halstead.level
old: 0.040624999999999994
new: 0.17777777777777778
path: .spaces[0].spaces[6].metrics.halstead.time
old: 1995.0707367408368
new: 31.933303447268276
path: .spaces[0].spaces[6].metrics.halstead.difficulty
old: 24.615384615384617
new: 5.625
path: .spaces[0].spaces[6].metrics.halstead.volume
old: 1458.8954762417368
new: 102.18657103125848
path: .spaces[0].spaces[6].metrics.halstead.n1
old: 20.0
new: 9.0
path: .spaces[0].spaces[6].metrics.halstead.N2
old: 96.0
new: 10.0
path: .spaces[0].spaces[6].metrics.halstead.length
old: 248.0
new: 25.0
path: .spaces[0].spaces[6].metrics.halstead.bugs
old: 0.3628267352915559
new: 0.023043917617966467
path: .spaces[0].spaces[6].metrics.halstead.n2
old: 39.0
new: 8.0
path: .spaces[0].spaces[6].metrics.halstead.N1
old: 152.0
new: 15.0
path: .spaces[0].spaces[6].metrics.halstead.estimated_program_length
old: 292.5692484333749
new: 52.529325012980806
path: .spaces[0].spaces[6].metrics.cyclomatic.sum
old: 11.0
new: 2.0
path: .spaces[0].spaces[6].metrics.cyclomatic.average
old: 11.0
new: 2.0
path: .spaces[0].spaces[6].metrics.loc.sloc
old: 50.0
new: 11.0
path: .spaces[0].spaces[6].metrics.loc.blank
old: 6.0
new: 1.0
path: .spaces[0].spaces[6].metrics.loc.cloc
old: 4.0
new: 3.0
path: .spaces[0].spaces[6].metrics.loc.lloc
old: 21.0
new: 4.0
path: .spaces[0].spaces[6].metrics.loc.ploc
old: 40.0
new: 7.0
Code
MessageLoopTimerCallback::Notify(nsITimer* aTimer) {
// We don't expect to hit the case when the timer fires but mTask has been
// deleted, because mTask should cancel the timer before the mTask is
// deleted. But you never know...
NS_WARNING_ASSERTION(mTask, "This timer shouldn't have fired.");
if (mTask) {
mTask->Run();
}
return NS_OK;
}