Global Metrics
path: .metrics.nargs.sum
old: 55.0
new: 25.0
path: .metrics.nargs.average
old: 2.037037037037037
new: 1.3157894736842106
path: .metrics.nexits.average
old: 0.07407407407407407
new: 2.1578947368421053
path: .metrics.nexits.sum
old: 2.0
new: 41.0
path: .metrics.loc.ploc
old: 371.0
new: 376.0
path: .metrics.loc.lloc
old: 83.0
new: 152.0
path: .metrics.loc.blank
old: 44.0
new: 64.0
path: .metrics.loc.cloc
old: 105.0
new: 22.0
path: .metrics.loc.sloc
old: 520.0
new: 462.0
path: .metrics.cognitive.sum
old: 6.0
new: 70.0
path: .metrics.cognitive.average
old: 0.2222222222222222
new: 3.6842105263157894
path: .metrics.nom.total
old: 27.0
new: 19.0
path: .metrics.nom.functions
old: 27.0
new: 18.0
path: .metrics.nom.closures
old: 0.0
new: 1.0
path: .metrics.mi.mi_sei
old: -26.86635664349331
new: -44.02420443444564
path: .metrics.mi.mi_visual_studio
old: 4.569529872914892
new: 3.146588775648107
path: .metrics.mi.mi_original
old: 7.813896082684465
new: 5.380666806358263
path: .metrics.cyclomatic.average
old: 1.8
new: 3.6
path: .metrics.cyclomatic.sum
old: 54.0
new: 72.0
path: .metrics.halstead.n2
old: 123.0
new: 211.0
path: .metrics.halstead.volume
old: 13499.385646568184
new: 14053.291461144412
path: .metrics.halstead.N1
old: 1053.0
new: 1020.0
path: .metrics.halstead.difficulty
old: 80.1951219512195
new: 53.74407582938389
path: .metrics.halstead.n1
old: 24.0
new: 30.0
path: .metrics.halstead.effort
old: 1082584.8781930776
new: 755281.1619401784
path: .metrics.halstead.estimated_program_length
old: 963.9683841740342
new: 1776.3586466854715
path: .metrics.halstead.time
old: 60143.604344059866
new: 41960.06455223213
path: .metrics.halstead.level
old: 0.012469586374695864
new: 0.01860670194003527
path: .metrics.halstead.length
old: 1875.0
new: 1776.0
path: .metrics.halstead.N2
old: 822.0
new: 756.0
path: .metrics.halstead.bugs
old: 3.514417743563074
new: 2.7645079749657993
path: .metrics.halstead.vocabulary
old: 147.0
new: 241.0
path: .metrics.halstead.purity_ratio
old: 0.5141164715594849
new: 1.0002019407012792
Spaces Data
Minimal test - lines (112, 119)
path: .spaces[5].metrics.loc.lloc
old: 5.0
new: 3.0
path: .spaces[5].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[5].metrics.loc.ploc
old: 10.0
new: 7.0
path: .spaces[5].metrics.loc.sloc
old: 17.0
new: 8.0
path: .spaces[5].metrics.loc.cloc
old: 7.0
new: 0.0
path: .spaces[5].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[5].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[5].metrics.mi.mi_sei
old: 105.21371300387234
new: 84.26347940245037
path: .spaces[5].metrics.mi.mi_original
old: 96.27766497043206
new: 110.66709685081524
path: .spaces[5].metrics.mi.mi_visual_studio
old: 56.30272805288424
new: 64.71760049755277
path: .spaces[5].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[5].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[5].metrics.halstead.estimated_program_length
old: 99.0586500259616
new: 76.2388309575275
path: .spaces[5].metrics.halstead.vocabulary
old: 26.0
new: 22.0
path: .spaces[5].metrics.halstead.time
old: 75.43915597016567
new: 63.76987214651334
path: .spaces[5].metrics.halstead.effort
old: 1357.904807462982
new: 1147.8576986372402
path: .spaces[5].metrics.halstead.volume
old: 244.4228653433368
new: 147.1612434150308
path: .spaces[5].metrics.halstead.N1
old: 27.0
new: 20.0
path: .spaces[5].metrics.halstead.length
old: 52.0
new: 33.0
path: .spaces[5].metrics.halstead.purity_ratio
old: 1.9049740389608003
new: 2.3102676047735606
path: .spaces[5].metrics.halstead.level
old: 0.18
new: 0.12820512820512822
path: .spaces[5].metrics.halstead.n2
old: 18.0
new: 10.0
path: .spaces[5].metrics.halstead.difficulty
old: 5.555555555555555
new: 7.8
path: .spaces[5].metrics.halstead.N2
old: 25.0
new: 13.0
path: .spaces[5].metrics.halstead.n1
old: 8.0
new: 12.0
path: .spaces[5].metrics.halstead.bugs
old: 0.04087504990121647
new: 0.03654299284303898
path: .spaces[5].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[5].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[5].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[5].metrics.cyclomatic.sum
old: 1.0
new: 3.0
Code
nsDirectoryService::Undefine(const char* aProp) {
if (NS_WARN_IF(!aProp)) {
return NS_ERROR_INVALID_ARG;
}
nsDependentCString key(aProp);
return mHashtable.Remove(key) ? NS_OK : NS_ERROR_FAILURE;
}
Minimal test - lines (455, 462)
path: .spaces[17].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[17].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[17].metrics.halstead.bugs
old: 0.02658160373607531
new: 0.03052057994028291
path: .spaces[17].metrics.halstead.volume
old: 155.58941141594505
new: 127.43782540330756
path: .spaces[17].metrics.halstead.estimated_program_length
old: 67.75720079023742
new: 62.05374780501027
path: .spaces[17].metrics.halstead.length
old: 36.0
new: 30.0
path: .spaces[17].metrics.halstead.time
old: 39.56226486858432
new: 48.674169424874414
path: .spaces[17].metrics.halstead.N1
old: 19.0
new: 20.0
path: .spaces[17].metrics.halstead.level
old: 0.2184873949579832
new: 0.14545454545454545
path: .spaces[17].metrics.halstead.n2
old: 13.0
new: 8.0
path: .spaces[17].metrics.halstead.effort
old: 712.1207676345177
new: 876.1350496477395
path: .spaces[17].metrics.halstead.n1
old: 7.0
new: 11.0
path: .spaces[17].metrics.halstead.purity_ratio
old: 1.882144466395484
new: 2.068458260167009
path: .spaces[17].metrics.halstead.N2
old: 17.0
new: 10.0
path: .spaces[17].metrics.halstead.vocabulary
old: 20.0
new: 19.0
path: .spaces[17].metrics.halstead.difficulty
old: 4.576923076923077
new: 6.875
path: .spaces[17].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[17].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[17].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[17].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[17].metrics.loc.sloc
old: 7.0
new: 8.0
path: .spaces[17].metrics.loc.lloc
old: 2.0
new: 4.0
path: .spaces[17].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[17].metrics.loc.ploc
old: 5.0
new: 7.0
path: .spaces[17].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[17].metrics.mi.mi_sei
old: 124.25819747392605
new: 85.57302133203632
path: .spaces[17].metrics.mi.mi_visual_studio
old: 66.08228577567823
new: 65.28969490970992
path: .spaces[17].metrics.mi.mi_original
old: 113.00070867640976
new: 111.64537829560396
Code
nsDirectoryService::GetFiles(const char* aProp, nsISimpleEnumerator** aResult) {
if (NS_WARN_IF(!aResult)) {
return NS_ERROR_INVALID_ARG;
}
*aResult = nullptr;
return NS_ERROR_FAILURE;
}
Minimal test - lines (224, 245)
path: .spaces[10].metrics.halstead.effort
old: 1052.8046991829706
new: 7524.238702880752
path: .spaces[10].metrics.halstead.N2
old: 19.0
new: 36.0
path: .spaces[10].metrics.halstead.estimated_program_length
old: 72.10571633583419
new: 173.16614563598216
path: .spaces[10].metrics.halstead.length
old: 41.0
new: 96.0
path: .spaces[10].metrics.halstead.purity_ratio
old: 1.7586760081910775
new: 1.803814017041481
path: .spaces[10].metrics.halstead.vocabulary
old: 21.0
new: 40.0
path: .spaces[10].metrics.halstead.volume
old: 180.0850143339292
new: 510.9050971091869
path: .spaces[10].metrics.halstead.bugs
old: 0.03449667907513436
new: 0.12799326623069018
path: .spaces[10].metrics.halstead.time
old: 58.48914995460947
new: 418.0132612711529
path: .spaces[10].metrics.halstead.level
old: 0.17105263157894737
new: 0.06790123456790123
path: .spaces[10].metrics.halstead.n2
old: 13.0
new: 22.0
path: .spaces[10].metrics.halstead.n1
old: 8.0
new: 18.0
path: .spaces[10].metrics.halstead.N1
old: 22.0
new: 60.0
path: .spaces[10].metrics.halstead.difficulty
old: 5.846153846153846
new: 14.727272727272728
path: .spaces[10].metrics.cyclomatic.sum
old: 1.0
new: 6.0
path: .spaces[10].metrics.cyclomatic.average
old: 1.0
new: 6.0
path: .spaces[10].metrics.loc.lloc
old: 2.0
new: 11.0
path: .spaces[10].metrics.loc.ploc
old: 8.0
new: 21.0
path: .spaces[10].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[10].metrics.loc.sloc
old: 8.0
new: 22.0
path: .spaces[10].metrics.nexits.sum
old: 0.0
new: 5.0
path: .spaces[10].metrics.nexits.average
old: 0.0
new: 2.5
path: .spaces[10].metrics.nom.total
old: 1.0
new: 2.0
path: .spaces[10].metrics.nom.closures
old: 0.0
new: 1.0
path: .spaces[10].metrics.mi.mi_sei
old: 83.20882152032584
new: 50.5932678802466
path: .spaces[10].metrics.mi.mi_original
old: 110.0772160103077
new: 87.11695621992905
path: .spaces[10].metrics.mi.mi_visual_studio
old: 64.37264094170041
new: 50.94558843270705
path: .spaces[10].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[10].metrics.cognitive.sum
old: 0.0
new: 7.0
path: .spaces[10].metrics.cognitive.average
old: 0.0
new: 3.5
Code
nsDirectoryService::Set(const char* aProp, nsISupports* aValue) {
if (NS_WARN_IF(!aProp)) {
return NS_ERROR_INVALID_ARG;
}
if (!aValue) {
return NS_ERROR_FAILURE;
}
const nsDependentCString key(aProp);
return mHashtable.WithEntryHandle(key, [&](auto&& entry) {
if (!entry) {
nsCOMPtr ourFile = do_QueryInterface(aValue);
if (ourFile) {
nsCOMPtr cloneFile;
ourFile->Clone(getter_AddRefs(cloneFile));
entry.Insert(std::move(cloneFile));
return NS_OK;
}
}
return NS_ERROR_FAILURE;
});
}
Minimal test - lines (73, 87)
path: .spaces[2].metrics.halstead.vocabulary
old: 28.0
new: 24.0
path: .spaces[2].metrics.halstead.time
old: 213.32637466630615
new: 106.4730180723024
path: .spaces[2].metrics.halstead.effort
old: 3839.8747439935105
new: 1916.5143253014433
path: .spaces[2].metrics.halstead.n2
old: 16.0
new: 13.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 107.01955000865388
new: 86.15946414084446
path: .spaces[2].metrics.halstead.n1
old: 12.0
new: 11.0
path: .spaces[2].metrics.halstead.N1
old: 41.0
new: 33.0
path: .spaces[2].metrics.halstead.length
old: 71.0
new: 52.0
path: .spaces[2].metrics.halstead.bugs
old: 0.08173789528158894
new: 0.05143042641923176
path: .spaces[2].metrics.halstead.N2
old: 30.0
new: 19.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.5073176057556883
new: 1.6569127719393166
path: .spaces[2].metrics.halstead.volume
old: 341.32219946608984
new: 238.4180500375001
path: .spaces[2].metrics.halstead.level
old: 0.08888888888888889
new: 0.12440191387559808
path: .spaces[2].metrics.halstead.difficulty
old: 11.25
new: 8.038461538461538
path: .spaces[2].metrics.nargs.average
old: 2.0
new: 3.0
path: .spaces[2].metrics.nargs.sum
old: 2.0
new: 3.0
path: .spaces[2].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[2].metrics.loc.ploc
old: 17.0
new: 13.0
path: .spaces[2].metrics.loc.lloc
old: 2.0
new: 7.0
path: .spaces[2].metrics.loc.sloc
old: 19.0
new: 15.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[2].metrics.mi.mi_original
old: 92.2793886697359
new: 97.74465338518208
path: .spaces[2].metrics.mi.mi_sei
old: 81.82198733181266
new: 65.72215415781793
path: .spaces[2].metrics.mi.mi_visual_studio
old: 53.96455477762333
new: 57.160616014726365
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 4.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 4.0
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[2].metrics.cyclomatic.average
old: 3.0
new: 4.0
path: .spaces[2].metrics.cyclomatic.sum
old: 3.0
new: 4.0
Code
nsresult nsDirectoryService::Create(nsISupports* aOuter, REFNSIID aIID,
void** aResult) {
if (NS_WARN_IF(!aResult)) {
return NS_ERROR_INVALID_ARG;
}
if (NS_WARN_IF(aOuter)) {
return NS_ERROR_NO_AGGREGATION;
}
if (!gService) {
return NS_ERROR_NOT_INITIALIZED;
}
return gService->QueryInterface(aIID, aResult);
}
Minimal test - lines (268, 275)
path: .spaces[12].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[12].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[12].metrics.loc.lloc
old: 2.0
new: 4.0
path: .spaces[12].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[12].metrics.loc.ploc
old: 8.0
new: 7.0
path: .spaces[12].metrics.mi.mi_sei
old: 83.09505839910031
new: 87.69819499624998
path: .spaces[12].metrics.mi.mi_original
old: 109.99836142357852
new: 113.11843642915392
path: .spaces[12].metrics.mi.mi_visual_studio
old: 64.32652714829155
new: 66.15113241470989
path: .spaces[12].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[12].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[12].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[12].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[12].metrics.halstead.n1
old: 8.0
new: 9.0
path: .spaces[12].metrics.halstead.N1
old: 22.0
new: 15.0
path: .spaces[12].metrics.halstead.time
old: 55.14122588759451
new: 30.857142857142858
path: .spaces[12].metrics.halstead.estimated_program_length
old: 77.30296890880646
new: 48.18080946738404
path: .spaces[12].metrics.halstead.length
old: 41.0
new: 24.0
path: .spaces[12].metrics.halstead.purity_ratio
old: 1.8854382660684503
new: 2.0075337278076684
path: .spaces[12].metrics.halstead.difficulty
old: 5.428571428571429
new: 5.785714285714286
path: .spaces[12].metrics.halstead.vocabulary
old: 22.0
new: 16.0
path: .spaces[12].metrics.halstead.effort
old: 992.5420659767012
new: 555.4285714285714
path: .spaces[12].metrics.halstead.n2
old: 14.0
new: 7.0
path: .spaces[12].metrics.halstead.volume
old: 182.8366963641292
new: 96.0
path: .spaces[12].metrics.halstead.N2
old: 19.0
new: 9.0
path: .spaces[12].metrics.halstead.level
old: 0.18421052631578944
new: 0.1728395061728395
path: .spaces[12].metrics.halstead.bugs
old: 0.033167394777450086
new: 0.022523241290852
path: .spaces[12].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[12].metrics.nargs.average
old: 2.0
new: 1.0
Code
nsDirectoryService::RegisterProvider(nsIDirectoryServiceProvider* aProv) {
if (!aProv) {
return NS_ERROR_FAILURE;
}
mProviders.AppendElement(aProv);
return NS_OK;
}
Minimal test - lines (248, 265)
path: .spaces[11].metrics.mi.mi_sei
old: 124.3877602665069
new: 58.93940085441358
path: .spaces[11].metrics.mi.mi_visual_studio
old: 66.13480395367995
new: 54.41123219677995
path: .spaces[11].metrics.mi.mi_original
old: 113.0905147607927
new: 93.04320705649371
path: .spaces[11].metrics.loc.sloc
old: 7.0
new: 18.0
path: .spaces[11].metrics.loc.lloc
old: 2.0
new: 8.0
path: .spaces[11].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[11].metrics.loc.ploc
old: 5.0
new: 15.0
path: .spaces[11].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[11].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[11].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[11].metrics.halstead.time
old: 42.12528117498222
new: 184.2810023684088
path: .spaces[11].metrics.halstead.vocabulary
old: 19.0
new: 30.0
path: .spaces[11].metrics.halstead.volume
old: 152.92539048396907
new: 333.66856050137926
path: .spaces[11].metrics.halstead.length
old: 36.0
new: 68.0
path: .spaces[11].metrics.halstead.effort
old: 758.2550611496799
new: 3317.0580426313586
path: .spaces[11].metrics.halstead.bugs
old: 0.02771760004787753
new: 0.07413912553572573
path: .spaces[11].metrics.halstead.n2
old: 12.0
new: 17.0
path: .spaces[11].metrics.halstead.n1
old: 7.0
new: 13.0
path: .spaces[11].metrics.halstead.difficulty
old: 4.958333333333333
new: 9.941176470588236
path: .spaces[11].metrics.halstead.purity_ratio
old: 1.7408620684182528
new: 1.7293027152513232
path: .spaces[11].metrics.halstead.N2
old: 17.0
new: 26.0
path: .spaces[11].metrics.halstead.N1
old: 19.0
new: 42.0
path: .spaces[11].metrics.halstead.estimated_program_length
old: 62.6710344630571
new: 117.59258463708996
path: .spaces[11].metrics.halstead.level
old: 0.20168067226890757
new: 0.10059171597633136
path: .spaces[11].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[11].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[11].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[11].metrics.nexits.average
old: 0.0
new: 3.0
Code
nsDirectoryService::Has(const char* aProp, bool* aResult) {
if (NS_WARN_IF(!aProp)) {
return NS_ERROR_INVALID_ARG;
}
*aResult = false;
nsCOMPtr value;
nsresult rv = Get(aProp, NS_GET_IID(nsIFile), getter_AddRefs(value));
if (NS_FAILED(rv)) {
return NS_OK;
}
if (value) {
*aResult = true;
}
return rv;
}
Minimal test - lines (90, 93)
path: .spaces[3].metrics.cyclomatic.sum
old: 3.0
new: 1.0
path: .spaces[3].metrics.cyclomatic.average
old: 3.0
new: 1.0
path: .spaces[3].metrics.loc.sloc
old: 14.0
new: 4.0
path: .spaces[3].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[3].metrics.loc.ploc
old: 12.0
new: 4.0
path: .spaces[3].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[3].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[3].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[3].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[3].metrics.mi.mi_visual_studio
old: 56.82578755757007
new: 75.93198520570938
path: .spaces[3].metrics.mi.mi_sei
old: 92.42678678198942
new: 111.72582230432585
path: .spaces[3].metrics.mi.mi_original
old: 97.1720967234448
new: 129.84369470176304
path: .spaces[3].metrics.halstead.bugs
old: 0.07905037015959379
new: 0.006553397824358721
path: .spaces[3].metrics.halstead.length
old: 71.0
new: 11.0
path: .spaces[3].metrics.halstead.level
old: 0.09444444444444444
new: 0.4
path: .spaces[3].metrics.halstead.effort
old: 3652.0586539841393
new: 87.1729375396636
path: .spaces[3].metrics.halstead.N1
old: 41.0
new: 7.0
path: .spaces[3].metrics.halstead.difficulty
old: 10.588235294117649
new: 2.5
path: .spaces[3].metrics.halstead.N2
old: 30.0
new: 4.0
path: .spaces[3].metrics.halstead.volume
old: 344.9166506540576
new: 34.86917501586544
path: .spaces[3].metrics.halstead.estimated_program_length
old: 112.50641830990963
new: 19.60964047443681
path: .spaces[3].metrics.halstead.time
old: 202.8921474435633
new: 4.842940974425755
path: .spaces[3].metrics.halstead.n2
old: 17.0
new: 4.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.5845974409846428
new: 1.7826945885851644
path: .spaces[3].metrics.halstead.vocabulary
old: 29.0
new: 9.0
path: .spaces[3].metrics.halstead.n1
old: 12.0
new: 5.0
Code
nsDirectoryService::Init() {
MOZ_ASSERT_UNREACHABLE("nsDirectoryService::Init() for internal use only!");
return NS_OK;
}
Minimal test - lines (334, 452)
path: .spaces[16].metrics.halstead.estimated_program_length
old: 77.30296890880646
new: 583.0147185349103
path: .spaces[16].metrics.halstead.vocabulary
old: 22.0
new: 98.0
path: .spaces[16].metrics.halstead.purity_ratio
old: 1.8854382660684503
new: 0.901104665432628
path: .spaces[16].metrics.halstead.N1
old: 22.0
new: 353.0
path: .spaces[16].metrics.halstead.n2
old: 14.0
new: 81.0
path: .spaces[16].metrics.halstead.bugs
old: 0.033167394777450086
new: 0.8643234371402797
path: .spaces[16].metrics.halstead.difficulty
old: 5.428571428571429
new: 30.85185185185185
path: .spaces[16].metrics.halstead.effort
old: 992.5420659767012
new: 132037.2031553976
path: .spaces[16].metrics.halstead.time
old: 55.14122588759451
new: 7335.400175299867
path: .spaces[16].metrics.halstead.N2
old: 19.0
new: 294.0
path: .spaces[16].metrics.halstead.volume
old: 182.8366963641292
new: 4279.717269142539
path: .spaces[16].metrics.halstead.level
old: 0.18421052631578944
new: 0.03241296518607443
path: .spaces[16].metrics.halstead.length
old: 41.0
new: 647.0
path: .spaces[16].metrics.halstead.n1
old: 8.0
new: 17.0
path: .spaces[16].metrics.loc.lloc
old: 2.0
new: 44.0
path: .spaces[16].metrics.loc.sloc
old: 8.0
new: 119.0
path: .spaces[16].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[16].metrics.loc.ploc
old: 8.0
new: 108.0
path: .spaces[16].metrics.loc.blank
old: 0.0
new: 8.0
path: .spaces[16].metrics.cyclomatic.average
old: 1.0
new: 10.0
path: .spaces[16].metrics.cyclomatic.sum
old: 1.0
new: 10.0
path: .spaces[16].metrics.mi.mi_visual_studio
old: 64.32652714829155
new: 27.95184785211998
path: .spaces[16].metrics.mi.mi_sei
old: 83.09505839910031
new: 6.449947455269644
path: .spaces[16].metrics.mi.mi_original
old: 109.99836142357852
new: 47.79765982712516
path: .spaces[16].metrics.nexits.average
old: 0.0
new: 3.0
path: .spaces[16].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[16].metrics.nargs.average
old: 2.0
new: 3.0
path: .spaces[16].metrics.nargs.sum
old: 2.0
new: 3.0
path: .spaces[16].metrics.cognitive.sum
old: 0.0
new: 8.0
path: .spaces[16].metrics.cognitive.average
old: 0.0
new: 8.0
Code
nsDirectoryService::GetFile(const char* aProp, bool* aPersistent,
nsIFile** aResult) {
nsCOMPtr localFile;
nsresult rv = NS_ERROR_FAILURE;
*aResult = nullptr;
*aPersistent = true;
RefPtr inAtom = NS_Atomize(aProp);
// check to see if it is one of our defaults
if (inAtom == nsGkAtoms::DirectoryService_CurrentProcess ||
inAtom == nsGkAtoms::DirectoryService_OS_CurrentProcessDirectory) {
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
}
// Unless otherwise set, the core pieces of the GRE exist
// in the current process directory.
else if (inAtom == nsGkAtoms::DirectoryService_GRE_Directory ||
inAtom == nsGkAtoms::DirectoryService_GRE_BinDirectory) {
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_OS_TemporaryDirectory) {
rv = GetSpecialSystemDirectory(OS_TemporaryDirectory,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_OS_CurrentWorkingDirectory) {
rv = GetSpecialSystemDirectory(OS_CurrentWorkingDirectory,
getter_AddRefs(localFile));
}
#if defined(MOZ_WIDGET_COCOA)
else if (inAtom == nsGkAtoms::DirectoryService_SystemDirectory) {
rv = GetOSXFolderType(kClassicDomain, kSystemFolderType,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_UserLibDirectory) {
rv = GetOSXFolderType(kUserDomain, kDomainLibraryFolderType,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::Home) {
rv = GetOSXFolderType(kUserDomain, kDomainTopLevelFolderType,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_DefaultDownloadDirectory) {
rv = GetOSXFolderType(kUserDomain, kDownloadsFolderType,
getter_AddRefs(localFile));
if (NS_FAILED(rv)) {
rv = GetOSXFolderType(kUserDomain, kDesktopFolderType,
getter_AddRefs(localFile));
}
} else if (inAtom == nsGkAtoms::DirectoryService_OS_DesktopDirectory) {
rv = GetOSXFolderType(kUserDomain, kDesktopFolderType,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_LocalApplicationsDirectory) {
rv = GetOSXFolderType(kLocalDomain, kApplicationsFolderType,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_UserPreferencesDirectory) {
rv = GetOSXFolderType(kUserDomain, kPreferencesFolderType,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_PictureDocumentsDirectory) {
rv = GetOSXFolderType(kUserDomain, kPictureDocumentsFolderType,
getter_AddRefs(localFile));
}
#elif defined(XP_WIN)
else if (inAtom == nsGkAtoms::DirectoryService_SystemDirectory) {
rv = GetSpecialSystemDirectory(Win_SystemDirectory,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_WindowsDirectory) {
rv = GetSpecialSystemDirectory(Win_WindowsDirectory,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_WindowsProgramFiles) {
rv = GetSpecialSystemDirectory(Win_ProgramFiles, getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::Home) {
rv =
GetSpecialSystemDirectory(Win_HomeDirectory, getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_Programs) {
rv = GetSpecialSystemDirectory(Win_Programs, getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_Favorites) {
rv = GetSpecialSystemDirectory(Win_Favorites, getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_OS_DesktopDirectory) {
rv = GetSpecialSystemDirectory(Win_Desktopdirectory,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_Appdata) {
rv = GetSpecialSystemDirectory(Win_Appdata, getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_LocalAppdata) {
rv = GetSpecialSystemDirectory(Win_LocalAppdata, getter_AddRefs(localFile));
# if defined(MOZ_SANDBOX)
} else if (inAtom == nsGkAtoms::DirectoryService_LocalAppdataLow) {
rv = GetSpecialSystemDirectory(Win_LocalAppdataLow,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_LowIntegrityTempBase) {
rv = GetLowIntegrityTempBase(getter_AddRefs(localFile));
# endif
} else if (inAtom == nsGkAtoms::DirectoryService_WinCookiesDirectory) {
rv = GetSpecialSystemDirectory(Win_Cookies, getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_DefaultDownloadDirectory) {
rv = GetSpecialSystemDirectory(Win_Downloads, getter_AddRefs(localFile));
}
#elif defined(XP_UNIX)
else if (inAtom == nsGkAtoms::Home) {
rv = GetSpecialSystemDirectory(Unix_HomeDirectory,
getter_AddRefs(localFile));
} else if (inAtom == nsGkAtoms::DirectoryService_OS_DesktopDirectory) {
rv = GetSpecialSystemDirectory(Unix_XDG_Desktop, getter_AddRefs(localFile));
*aPersistent = false;
} else if (inAtom == nsGkAtoms::DirectoryService_DefaultDownloadDirectory) {
rv =
GetSpecialSystemDirectory(Unix_XDG_Download, getter_AddRefs(localFile));
*aPersistent = false;
}
#endif
if (NS_FAILED(rv)) {
return rv;
}
if (!localFile) {
return NS_ERROR_FAILURE;
}
localFile.forget(aResult);
return NS_OK;
}
Minimal test - lines (136, 173)
path: .spaces[8].metrics.nexits.average
old: 0.0
new: 3.0
path: .spaces[8].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[8].metrics.cyclomatic.average
old: 1.0
new: 9.0
path: .spaces[8].metrics.cyclomatic.sum
old: 1.0
new: 9.0
path: .spaces[8].metrics.mi.mi_sei
old: 75.90977439348593
new: 49.57668492328669
path: .spaces[8].metrics.mi.mi_visual_studio
old: 61.413977820797925
new: 43.35714705750593
path: .spaces[8].metrics.mi.mi_original
old: 105.01790207356446
new: 74.14072146833513
path: .spaces[8].metrics.loc.cloc
old: 0.0
new: 2.0
path: .spaces[8].metrics.loc.lloc
old: 2.0
new: 15.0
path: .spaces[8].metrics.loc.ploc
old: 10.0
new: 33.0
path: .spaces[8].metrics.loc.sloc
old: 10.0
new: 38.0
path: .spaces[8].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[8].metrics.cognitive.sum
old: 0.0
new: 21.0
path: .spaces[8].metrics.cognitive.average
old: 0.0
new: 21.0
path: .spaces[8].metrics.halstead.length
old: 50.0
new: 177.0
path: .spaces[8].metrics.halstead.vocabulary
old: 27.0
new: 48.0
path: .spaces[8].metrics.halstead.effort
old: 1608.270772790585
new: 20057.76226105769
path: .spaces[8].metrics.halstead.level
old: 0.14782608695652175
new: 0.0492845786963434
path: .spaces[8].metrics.halstead.n2
old: 17.0
new: 31.0
path: .spaces[8].metrics.halstead.bugs
old: 0.04575636597638663
new: 0.24607475699747863
path: .spaces[8].metrics.halstead.volume
old: 237.7443751081734
new: 988.5383626276446
path: .spaces[8].metrics.halstead.N2
old: 23.0
new: 74.0
path: .spaces[8].metrics.halstead.estimated_program_length
old: 102.7061492501294
new: 223.0669539232489
path: .spaces[8].metrics.halstead.n1
old: 10.0
new: 17.0
path: .spaces[8].metrics.halstead.difficulty
old: 6.764705882352941
new: 20.29032258064516
path: .spaces[8].metrics.halstead.N1
old: 27.0
new: 103.0
path: .spaces[8].metrics.halstead.purity_ratio
old: 2.0541229850025875
new: 1.2602652764025362
path: .spaces[8].metrics.halstead.time
old: 89.3483762661436
new: 1114.320125614316
Code
static bool FindProviderFile(nsIDirectoryServiceProvider* aElement,
FileData* aData) {
nsresult rv;
if (aData->uuid.Equals(NS_GET_IID(nsISimpleEnumerator))) {
// Not all providers implement this iface
nsCOMPtr prov2 = do_QueryInterface(aElement);
if (prov2) {
nsCOMPtr newFiles;
rv = prov2->GetFiles(aData->property, getter_AddRefs(newFiles));
if (NS_SUCCEEDED(rv) && newFiles) {
if (aData->data) {
nsCOMPtr unionFiles;
NS_NewUnionEnumerator(getter_AddRefs(unionFiles),
(nsISimpleEnumerator*)aData->data.get(),
newFiles);
if (unionFiles) {
unionFiles.swap(*(nsISimpleEnumerator**)&aData->data);
}
} else {
aData->data = newFiles;
}
aData->persistent = false; // Enumerators can never be persistent
return rv == NS_SUCCESS_AGGREGATE_RESULT;
}
}
} else {
rv = aElement->GetFile(aData->property, &aData->persistent,
(nsIFile**)&aData->data);
if (NS_SUCCEEDED(rv) && aData->data) {
return false;
}
}
return true;
}
Minimal test - lines (122, 124)
path: .spaces[6].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[6].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[6].metrics.loc.sloc
old: 8.0
new: 3.0
path: .spaces[6].metrics.loc.lloc
old: 2.0
new: 1.0
path: .spaces[6].metrics.loc.ploc
old: 8.0
new: 3.0
path: .spaces[6].metrics.halstead.length
old: 41.0
new: 13.0
path: .spaces[6].metrics.halstead.level
old: 0.17105263157894737
new: 0.25
path: .spaces[6].metrics.halstead.N1
old: 22.0
new: 8.0
path: .spaces[6].metrics.halstead.time
old: 58.48914995460947
new: 10.690159185740931
path: .spaces[6].metrics.halstead.difficulty
old: 5.846153846153846
new: 4.0
path: .spaces[6].metrics.halstead.bugs
old: 0.03449667907513436
new: 0.011110063219277547
path: .spaces[6].metrics.halstead.N2
old: 19.0
new: 5.0
path: .spaces[6].metrics.halstead.estimated_program_length
old: 72.10571633583419
new: 35.60964047443681
path: .spaces[6].metrics.halstead.n2
old: 13.0
new: 5.0
path: .spaces[6].metrics.halstead.effort
old: 1052.8046991829706
new: 192.4228653433368
path: .spaces[6].metrics.halstead.vocabulary
old: 21.0
new: 13.0
path: .spaces[6].metrics.halstead.volume
old: 180.0850143339292
new: 48.105716335834195
path: .spaces[6].metrics.halstead.purity_ratio
old: 1.7586760081910775
new: 2.739203113418216
path: .spaces[6].metrics.mi.mi_visual_studio
old: 64.37264094170041
new: 77.67882786962677
path: .spaces[6].metrics.mi.mi_original
old: 110.0772160103077
new: 132.8307956570618
path: .spaces[6].metrics.mi.mi_sei
old: 83.20882152032584
new: 116.03529803917004
path: .spaces[6].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[6].metrics.nargs.sum
old: 2.0
new: 1.0
Code
nsDirectoryService::GetKeys(nsTArray& aKeys) {
return NS_ERROR_NOT_IMPLEMENTED;
}
Minimal test - lines (95, 104)
path: .spaces[4].metrics.mi.mi_original
old: 115.98135200850813
new: 107.5910259062542
path: .spaces[4].metrics.mi.mi_sei
old: 91.72668924566358
new: 103.1487995054456
path: .spaces[4].metrics.mi.mi_visual_studio
old: 67.82535205175913
new: 62.91872860014865
path: .spaces[4].metrics.halstead.bugs
old: 0.022837935752198977
new: 0.03880776032110825
path: .spaces[4].metrics.halstead.estimated_program_length
old: 58.529325012980806
new: 71.54887502163469
path: .spaces[4].metrics.halstead.volume
old: 141.7774500490386
new: 144.94647495169912
path: .spaces[4].metrics.halstead.difficulty
old: 4.0
new: 8.666666666666666
path: .spaces[4].metrics.halstead.purity_ratio
old: 1.721450735675906
new: 2.1681477279283237
path: .spaces[4].metrics.halstead.vocabulary
old: 18.0
new: 21.0
path: .spaces[4].metrics.halstead.n2
old: 12.0
new: 9.0
path: .spaces[4].metrics.halstead.n1
old: 6.0
new: 12.0
path: .spaces[4].metrics.halstead.N2
old: 16.0
new: 13.0
path: .spaces[4].metrics.halstead.N1
old: 18.0
new: 20.0
path: .spaces[4].metrics.halstead.length
old: 34.0
new: 33.0
path: .spaces[4].metrics.halstead.time
old: 31.50610001089747
new: 69.78904349526253
path: .spaces[4].metrics.halstead.effort
old: 567.1098001961544
new: 1256.2027829147255
path: .spaces[4].metrics.halstead.level
old: 0.25
new: 0.1153846153846154
path: .spaces[4].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[4].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[4].metrics.loc.sloc
old: 6.0
new: 10.0
path: .spaces[4].metrics.loc.lloc
old: 2.0
new: 3.0
path: .spaces[4].metrics.loc.ploc
old: 6.0
new: 7.0
path: .spaces[4].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[4].metrics.nargs.sum
old: 2.0
new: 0.0
Code
void nsDirectoryService::RealInit() {
NS_ASSERTION(!gService,
"nsDirectoryService::RealInit Mustn't initialize twice!");
gService = new nsDirectoryService();
// Let the list hold the only reference to the provider.
nsAppFileLocationProvider* defaultProvider = new nsAppFileLocationProvider;
gService->mProviders.AppendElement(defaultProvider);
}
Minimal test - lines (310, 325)
path: .spaces[15].metrics.nexits.average
old: 0.0
new: 3.0
path: .spaces[15].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[15].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[15].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[15].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[15].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[15].metrics.halstead.purity_ratio
old: 2.1752384198263823
new: 1.6215083334644529
path: .spaces[15].metrics.halstead.difficulty
old: 7.333333333333333
new: 11.25
path: .spaces[15].metrics.halstead.vocabulary
old: 29.0
new: 28.0
path: .spaces[15].metrics.halstead.bugs
old: 0.05027890367938762
new: 0.07785392430259241
path: .spaces[15].metrics.halstead.time
old: 102.91722700788782
new: 198.30339053487617
path: .spaces[15].metrics.halstead.level
old: 0.13636363636363638
new: 0.08888888888888889
path: .spaces[15].metrics.halstead.n1
old: 11.0
new: 12.0
path: .spaces[15].metrics.halstead.N1
old: 28.0
new: 36.0
path: .spaces[15].metrics.halstead.volume
old: 252.61501174663377
new: 317.28542485580186
path: .spaces[15].metrics.halstead.length
old: 52.0
new: 66.0
path: .spaces[15].metrics.halstead.effort
old: 1852.5100861419808
new: 3569.461029627771
path: .spaces[15].metrics.halstead.n2
old: 18.0
new: 16.0
path: .spaces[15].metrics.halstead.estimated_program_length
old: 113.11239783097189
new: 107.01955000865388
path: .spaces[15].metrics.halstead.N2
old: 24.0
new: 30.0
path: .spaces[15].metrics.mi.mi_visual_studio
old: 61.22948244485371
new: 55.81467458130127
path: .spaces[15].metrics.mi.mi_original
old: 104.70241498069986
new: 95.44309353402518
path: .spaces[15].metrics.mi.mi_sei
old: 75.45462272914573
new: 62.29988531484027
path: .spaces[15].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[15].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[15].metrics.loc.ploc
old: 10.0
new: 14.0
path: .spaces[15].metrics.loc.lloc
old: 2.0
new: 7.0
path: .spaces[15].metrics.loc.sloc
old: 10.0
new: 16.0
path: .spaces[15].metrics.loc.blank
old: 0.0
new: 2.0
Code
static nsresult GetLowIntegrityTempBase(nsIFile** aLowIntegrityTempBase) {
nsCOMPtr localFile;
nsresult rv =
GetSpecialSystemDirectory(Win_LocalAppdataLow, getter_AddRefs(localFile));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = localFile->Append(NS_LITERAL_STRING_FROM_CSTRING(MOZ_USER_DIR));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
localFile.forget(aLowIntegrityTempBase);
return rv;
}
Minimal test - lines (71, 71)
path: .spaces[1].metrics.mi.mi_original
old: 115.7204088499574
new: 154.58924178123317
path: .spaces[1].metrics.mi.mi_visual_studio
old: 67.67275371342538
new: 90.4030653691422
path: .spaces[1].metrics.mi.mi_sei
old: 91.45204770427308
new: 147.42610035996177
path: .spaces[1].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[1].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[1].metrics.halstead.level
old: 0.1746031746031746
new: 0.5
path: .spaces[1].metrics.halstead.volume
old: 142.62362713128297
new: 22.458839376460833
path: .spaces[1].metrics.halstead.time
old: 45.38024499631731
new: 2.495426597384537
path: .spaces[1].metrics.halstead.bugs
old: 0.02912761816732554
new: 0.00421201861424495
path: .spaces[1].metrics.halstead.purity_ratio
old: 2.017668873272457
new: 1.5943609377704335
path: .spaces[1].metrics.halstead.difficulty
old: 5.7272727272727275
new: 2.0
path: .spaces[1].metrics.halstead.n1
old: 9.0
new: 4.0
path: .spaces[1].metrics.halstead.N2
old: 14.0
new: 3.0
path: .spaces[1].metrics.halstead.n2
old: 11.0
new: 3.0
path: .spaces[1].metrics.halstead.vocabulary
old: 20.0
new: 7.0
path: .spaces[1].metrics.halstead.effort
old: 816.8444099337116
new: 44.91767875292167
path: .spaces[1].metrics.halstead.length
old: 33.0
new: 8.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 66.58307281799108
new: 12.754887502163468
path: .spaces[1].metrics.halstead.N1
old: 19.0
new: 5.0
path: .spaces[1].metrics.loc.sloc
old: 6.0
new: 1.0
path: .spaces[1].metrics.loc.ploc
old: 6.0
new: 1.0
path: .spaces[1].metrics.loc.lloc
old: 1.0
new: 0.0
path: .spaces[1].metrics.cyclomatic.average
old: 2.0
new: 1.0
path: .spaces[1].metrics.cyclomatic.sum
old: 2.0
new: 1.0
Code
nsDirectoryService::nsDirectoryService() : mHashtable(128) {}
Minimal test - lines (126, 134)
path: .spaces[7].metrics.halstead.purity_ratio
old: 2.0003304758007463
new: 1.694196243500611
path: .spaces[7].metrics.halstead.bugs
old: 0.04054083029586902
new: 0.04696265011623211
path: .spaces[7].metrics.halstead.effort
old: 1341.2842983942608
new: 1672.2868569889863
path: .spaces[7].metrics.halstead.time
old: 74.51579435523671
new: 92.90482538827705
path: .spaces[7].metrics.halstead.estimated_program_length
old: 98.01619331423656
new: 76.2388309575275
path: .spaces[7].metrics.halstead.length
old: 49.0
new: 45.0
path: .spaces[7].metrics.halstead.N1
old: 27.0
new: 25.0
path: .spaces[7].metrics.halstead.N2
old: 22.0
new: 20.0
path: .spaces[7].metrics.halstead.n1
old: 9.0
new: 10.0
path: .spaces[7].metrics.halstead.difficulty
old: 5.823529411764706
new: 8.333333333333334
path: .spaces[7].metrics.halstead.level
old: 0.1717171717171717
new: 0.12
path: .spaces[7].metrics.halstead.n2
old: 17.0
new: 12.0
path: .spaces[7].metrics.halstead.vocabulary
old: 26.0
new: 22.0
path: .spaces[7].metrics.halstead.volume
old: 230.3215461889135
new: 200.67442283867837
path: .spaces[7].metrics.mi.mi_visual_studio
old: 60.607496790208955
new: 62.79310295087826
path: .spaces[7].metrics.mi.mi_sei
old: 73.92017881986901
new: 79.41390769883456
path: .spaces[7].metrics.mi.mi_original
old: 103.63881951125732
new: 107.37620604600184
path: .spaces[7].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[7].metrics.loc.sloc
old: 11.0
new: 9.0
path: .spaces[7].metrics.loc.lloc
old: 2.0
new: 0.0
path: .spaces[7].metrics.loc.ploc
old: 11.0
new: 8.0
path: .spaces[7].metrics.cyclomatic.sum
old: 1.0
new: 2.0
Code
struct MOZ_STACK_CLASS FileData {
FileData(const char* aProperty, const nsIID& aUUID)
: property(aProperty), data(nullptr), persistent(true), uuid(aUUID) {}
const char* property;
nsCOMPtr data;
bool persistent;
const nsIID& uuid;
};
Minimal test - lines (44, 67)
path: .spaces[0].metrics.mi.mi_visual_studio
old: 30.51693902318923
new: 50.85565530295849
path: .spaces[0].metrics.mi.mi_original
old: 52.18396572965359
new: 86.96317056805901
path: .spaces[0].metrics.mi.mi_sei
old: 33.66801876847969
new: 71.9941440306273
path: .spaces[0].metrics.cyclomatic.average
old: 2.0
new: 6.0
path: .spaces[0].metrics.cyclomatic.sum
old: 12.0
new: 6.0
path: .spaces[0].metrics.nexits.average
old: 0.4
new: 4.0
path: .spaces[0].metrics.nexits.sum
old: 2.0
new: 4.0
path: .spaces[0].metrics.nom.functions
old: 5.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 5.0
new: 1.0
path: .spaces[0].metrics.loc.cloc
old: 24.0
new: 2.0
path: .spaces[0].metrics.loc.blank
old: 11.0
new: 2.0
path: .spaces[0].metrics.loc.ploc
old: 77.0
new: 20.0
path: .spaces[0].metrics.loc.lloc
old: 19.0
new: 10.0
path: .spaces[0].metrics.loc.sloc
old: 112.0
new: 24.0
path: .spaces[0].metrics.cognitive.average
old: 1.0
new: 8.0
path: .spaces[0].metrics.cognitive.sum
old: 5.0
new: 8.0
path: .spaces[0].metrics.nargs.sum
old: 11.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: 2.2
new: 1.0
path: .spaces[0].metrics.halstead.n1
old: 18.0
new: 12.0
path: .spaces[0].metrics.halstead.n2
old: 53.0
new: 19.0
path: .spaces[0].metrics.halstead.level
old: 0.044953350296861753
new: 0.1021505376344086
path: .spaces[0].metrics.halstead.volume
old: 2035.5662965560496
new: 401.2899011413369
path: .spaces[0].metrics.halstead.bugs
old: 0.4234747659157264
new: 0.08298962351539327
path: .spaces[0].metrics.halstead.N2
old: 131.0
new: 31.0
path: .spaces[0].metrics.halstead.difficulty
old: 22.245283018867923
new: 9.789473684210526
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.14392276168523
new: 1.527532997087432
path: .spaces[0].metrics.halstead.estimated_program_length
old: 378.63843411781113
new: 123.730172764082
path: .spaces[0].metrics.halstead.effort
old: 45281.74837055816
new: 3928.416926962561
path: .spaces[0].metrics.halstead.time
old: 2515.6526872532313
new: 218.24538483125335
path: .spaces[0].metrics.halstead.length
old: 331.0
new: 81.0
path: .spaces[0].metrics.halstead.vocabulary
old: 71.0
new: 31.0
path: .spaces[0].metrics.halstead.N1
old: 200.0
new: 50.0
Code
nsresult nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile)
//----------------------------------------------------------------------------------------
{
if (NS_WARN_IF(!aFile)) {
return NS_ERROR_INVALID_ARG;
}
*aFile = nullptr;
// Set the component registry location:
if (!gService) {
return NS_ERROR_FAILURE;
}
if (!mXCurProcD) {
nsCOMPtr file;
if (NS_SUCCEEDED(BinaryPath::GetFile(getter_AddRefs(file)))) {
nsresult rv = file->GetParent(getter_AddRefs(mXCurProcD));
if (NS_FAILED(rv)) {
return rv;
}
}
}
return mXCurProcD->Clone(aFile);
} // GetCurrentProcessDirectory()
Minimal test - lines (300, 307)
path: .spaces[14].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[14].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[14].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[14].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[14].metrics.mi.mi_original
old: 103.21286473689004
new: 113.11843642915392
path: .spaces[14].metrics.mi.mi_sei
old: 73.30565597924634
new: 87.69819499624998
path: .spaces[14].metrics.mi.mi_visual_studio
old: 60.35840043092984
new: 66.15113241470989
path: .spaces[14].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[14].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[14].metrics.halstead.estimated_program_length
old: 108.27793097483524
new: 48.18080946738404
path: .spaces[14].metrics.halstead.difficulty
old: 6.388888888888889
new: 5.785714285714286
path: .spaces[14].metrics.halstead.length
old: 52.0
new: 24.0
path: .spaces[14].metrics.halstead.level
old: 0.15652173913043477
new: 0.1728395061728395
path: .spaces[14].metrics.halstead.N2
old: 23.0
new: 9.0
path: .spaces[14].metrics.halstead.effort
old: 1597.110135216915
new: 555.4285714285714
path: .spaces[14].metrics.halstead.vocabulary
old: 28.0
new: 16.0
path: .spaces[14].metrics.halstead.n2
old: 18.0
new: 7.0
path: .spaces[14].metrics.halstead.time
old: 88.72834084538417
new: 30.857142857142858
path: .spaces[14].metrics.halstead.N1
old: 29.0
new: 15.0
path: .spaces[14].metrics.halstead.n1
old: 10.0
new: 9.0
path: .spaces[14].metrics.halstead.volume
old: 249.9824559469954
new: 96.0
path: .spaces[14].metrics.halstead.bugs
old: 0.04554443537780877
new: 0.022523241290852
path: .spaces[14].metrics.halstead.purity_ratio
old: 2.082267903362216
new: 2.0075337278076684
path: .spaces[14].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[14].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[14].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[14].metrics.loc.lloc
old: 2.0
new: 4.0
path: .spaces[14].metrics.loc.ploc
old: 11.0
new: 7.0
path: .spaces[14].metrics.loc.sloc
old: 11.0
new: 8.0
Code
nsDirectoryService::UnregisterProvider(nsIDirectoryServiceProvider* aProv) {
if (!aProv) {
return NS_ERROR_FAILURE;
}
mProviders.RemoveElement(aProv);
return NS_OK;
}
Minimal test - lines (176, 221)
path: .spaces[9].metrics.loc.ploc
old: 6.0
new: 37.0
path: .spaces[9].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[9].metrics.loc.blank
old: 0.0
new: 6.0
path: .spaces[9].metrics.loc.sloc
old: 6.0
new: 46.0
path: .spaces[9].metrics.loc.lloc
old: 2.0
new: 21.0
path: .spaces[9].metrics.halstead.purity_ratio
old: 1.721450735675906
new: 1.2607150047494775
path: .spaces[9].metrics.halstead.effort
old: 567.1098001961544
new: 38739.253859872966
path: .spaces[9].metrics.halstead.estimated_program_length
old: 58.529325012980806
new: 297.52874112087676
path: .spaces[9].metrics.halstead.difficulty
old: 4.0
new: 27.789473684210527
path: .spaces[9].metrics.halstead.length
old: 34.0
new: 236.0
path: .spaces[9].metrics.halstead.n2
old: 12.0
new: 38.0
path: .spaces[9].metrics.halstead.time
old: 31.50610001089747
new: 2152.1807699929427
path: .spaces[9].metrics.halstead.bugs
old: 0.022837935752198977
new: 0.3816332856753212
path: .spaces[9].metrics.halstead.volume
old: 141.7774500490386
new: 1394.0261805636103
path: .spaces[9].metrics.halstead.vocabulary
old: 18.0
new: 60.0
path: .spaces[9].metrics.halstead.N2
old: 16.0
new: 96.0
path: .spaces[9].metrics.halstead.N1
old: 18.0
new: 140.0
path: .spaces[9].metrics.halstead.level
old: 0.25
new: 0.03598484848484848
path: .spaces[9].metrics.halstead.n1
old: 6.0
new: 22.0
path: .spaces[9].metrics.nexits.sum
old: 0.0
new: 5.0
path: .spaces[9].metrics.nexits.average
old: 0.0
new: 5.0
path: .spaces[9].metrics.mi.mi_original
old: 115.98135200850813
new: 69.2582622422883
path: .spaces[9].metrics.mi.mi_sei
old: 91.72668924566358
new: 44.40347906158277
path: .spaces[9].metrics.mi.mi_visual_studio
old: 67.82535205175913
new: 40.50190774402824
path: .spaces[9].metrics.nargs.sum
old: 2.0
new: 3.0
path: .spaces[9].metrics.nargs.average
old: 2.0
new: 3.0
path: .spaces[9].metrics.cognitive.sum
old: 0.0
new: 11.0
path: .spaces[9].metrics.cognitive.average
old: 0.0
new: 11.0
path: .spaces[9].metrics.cyclomatic.sum
old: 1.0
new: 9.0
path: .spaces[9].metrics.cyclomatic.average
old: 1.0
new: 9.0
Code
nsDirectoryService::Get(const char* aProp, const nsIID& aUuid, void** aResult) {
if (NS_WARN_IF(!aProp)) {
return NS_ERROR_INVALID_ARG;
}
MOZ_ASSERT(NS_IsMainThread(), "Do not call dirsvc::get on non-main threads!");
nsDependentCString key(aProp);
nsCOMPtr cachedFile = mHashtable.Get(key);
if (cachedFile) {
nsCOMPtr cloneFile;
cachedFile->Clone(getter_AddRefs(cloneFile));
return cloneFile->QueryInterface(aUuid, aResult);
}
// it is not one of our defaults, lets check any providers
FileData fileData(aProp, aUuid);
for (int32_t i = mProviders.Length() - 1; i >= 0; i--) {
if (!FindProviderFile(mProviders[i], &fileData)) {
break;
}
}
if (fileData.data) {
if (fileData.persistent) {
Set(aProp, static_cast(fileData.data.get()));
}
nsresult rv = (fileData.data)->QueryInterface(aUuid, aResult);
fileData.data = nullptr; // AddRef occurs in FindProviderFile()
return rv;
}
FindProviderFile(static_cast(this), &fileData);
if (fileData.data) {
if (fileData.persistent) {
Set(aProp, static_cast(fileData.data.get()));
}
nsresult rv = (fileData.data)->QueryInterface(aUuid, aResult);
fileData.data = nullptr; // AddRef occurs in FindProviderFile()
return rv;
}
return NS_ERROR_FAILURE;
}
Minimal test - lines (277, 297)
path: .spaces[13].metrics.mi.mi_visual_studio
old: 65.16068139235622
new: 52.32930863486727
path: .spaces[13].metrics.mi.mi_original
old: 111.42476518092914
new: 89.48311776562304
path: .spaces[13].metrics.mi.mi_sei
old: 111.19013900177144
new: 53.80327768935253
path: .spaces[13].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[13].metrics.loc.lloc
old: 2.0
new: 6.0
path: .spaces[13].metrics.loc.sloc
old: 8.0
new: 21.0
path: .spaces[13].metrics.loc.ploc
old: 7.0
new: 18.0
path: .spaces[13].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[13].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[13].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[13].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[13].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[13].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[13].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[13].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[13].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[13].metrics.halstead.estimated_program_length
old: 53.5635228093372
new: 161.72553417960972
path: .spaces[13].metrics.halstead.vocabulary
old: 17.0
new: 38.0
path: .spaces[13].metrics.halstead.N1
old: 18.0
new: 46.0
path: .spaces[13].metrics.halstead.n2
old: 11.0
new: 21.0
path: .spaces[13].metrics.halstead.bugs
old: 0.023881756713922776
new: 0.10135226028117868
path: .spaces[13].metrics.halstead.effort
old: 606.4308506291412
new: 5301.906196439005
path: .spaces[13].metrics.halstead.length
old: 34.0
new: 78.0
path: .spaces[13].metrics.halstead.level
old: 0.22916666666666669
new: 0.07720588235294118
path: .spaces[13].metrics.halstead.time
old: 33.69060281273007
new: 294.55034424661136
path: .spaces[13].metrics.halstead.volume
old: 138.97373660251154
new: 409.3383460485997
path: .spaces[13].metrics.halstead.purity_ratio
old: 1.5753977296863884
new: 2.0734042843539706
path: .spaces[13].metrics.halstead.N2
old: 16.0
new: 32.0
path: .spaces[13].metrics.halstead.n1
old: 6.0
new: 17.0
path: .spaces[13].metrics.halstead.difficulty
old: 4.363636363636363
new: 12.952380952380953
Code
void nsDirectoryService::RegisterCategoryProviders() {
nsCOMPtr catman(
do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
if (!catman) {
return;
}
nsCOMPtr entries;
catman->EnumerateCategory(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
getter_AddRefs(entries));
for (auto& categoryEntry : SimpleEnumerator(entries)) {
nsAutoCString contractID;
categoryEntry->GetValue(contractID);
if (nsCOMPtr provider =
do_GetService(contractID.get())) {
RegisterProvider(provider);
}
}
}