Global Metrics
path: .metrics.nom.functions
old: 44.0
new: 8.0
path: .metrics.nom.total
old: 44.0
new: 8.0
path: .metrics.cognitive.average
old: 0.1590909090909091
new: 8.375
path: .metrics.cognitive.sum
old: 7.0
new: 67.0
path: .metrics.halstead.n2
old: 196.0
new: 153.0
path: .metrics.halstead.bugs
old: 3.514604433551867
new: 2.1885182694000376
path: .metrics.halstead.effort
old: 1082671.1416046373
new: 531994.505232786
path: .metrics.halstead.estimated_program_length
old: 1551.0864883807085
new: 1238.7623024903896
path: .metrics.halstead.level
old: 0.020118039517577624
new: 0.019307211811470753
path: .metrics.halstead.N2
old: 1299.0
new: 587.0
path: .metrics.halstead.volume
old: 21781.22081134297
new: 10271.330595067984
path: .metrics.halstead.n1
old: 15.0
new: 27.0
path: .metrics.halstead.vocabulary
old: 211.0
new: 180.0
path: .metrics.halstead.difficulty
old: 49.70663265306123
new: 51.794117647058826
path: .metrics.halstead.purity_ratio
old: 0.5498356924426474
new: 0.903546537192115
path: .metrics.halstead.length
old: 2821.0
new: 1371.0
path: .metrics.halstead.N1
old: 1522.0
new: 784.0
path: .metrics.halstead.time
old: 60148.396755813184
new: 29555.25029071033
path: .metrics.loc.lloc
old: 381.0
new: 137.0
path: .metrics.loc.ploc
old: 770.0
new: 334.0
path: .metrics.loc.sloc
old: 1188.0
new: 431.0
path: .metrics.loc.blank
old: 217.0
new: 49.0
path: .metrics.loc.cloc
old: 201.0
new: 48.0
path: .metrics.nargs.average
old: 0.0
new: 1.375
path: .metrics.nargs.sum
old: 0.0
new: 11.0
path: .metrics.nexits.average
old: 0.0
new: 3.75
path: .metrics.nexits.sum
old: 0.0
new: 30.0
path: .metrics.mi.mi_original
old: -7.36820722241913
new: 9.286067289740204
path: .metrics.mi.mi_sei
old: -51.38959404382013
new: -30.768387823345194
path: .metrics.mi.mi_visual_studio
old: 0.0
new: 5.43044870745041
path: .metrics.cyclomatic.sum
old: 51.0
new: 67.0
path: .metrics.cyclomatic.average
old: 1.1333333333333333
new: 6.7
Spaces Data
Minimal test - lines (316, 350)
path: .spaces[2].metrics.loc.sloc
old: 15.0
new: 35.0
path: .spaces[2].metrics.loc.lloc
old: 6.0
new: 15.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.blank
old: 3.0
new: 6.0
path: .spaces[2].metrics.loc.ploc
old: 12.0
new: 28.0
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 5.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 5.0
path: .spaces[2].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[2].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[2].metrics.mi.mi_visual_studio
old: 56.99652708262877
new: 45.46520322852135
path: .spaces[2].metrics.mi.mi_sei
old: 65.0118857860952
new: 50.22070109521441
path: .spaces[2].metrics.mi.mi_original
old: 97.4640613112952
new: 77.74549752077151
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 8.0
path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 8.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 124.49230970275752
new: 191.15505477032977
path: .spaces[2].metrics.halstead.effort
old: 2133.524641068108
new: 12254.025170248651
path: .spaces[2].metrics.halstead.vocabulary
old: 31.0
new: 43.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 2.146419132806164
new: 1.5541061363441442
path: .spaces[2].metrics.halstead.bugs
old: 0.05524299137655787
new: 0.1771731570683446
path: .spaces[2].metrics.halstead.N1
old: 31.0
new: 72.0
path: .spaces[2].metrics.halstead.N2
old: 27.0
new: 51.0
path: .spaces[2].metrics.halstead.difficulty
old: 7.425
new: 18.36
path: .spaces[2].metrics.halstead.level
old: 0.13468013468013468
new: 0.054466230936819175
path: .spaces[2].metrics.halstead.n2
old: 20.0
new: 25.0
path: .spaces[2].metrics.halstead.volume
old: 287.34338600243876
new: 667.430564828358
path: .spaces[2].metrics.halstead.n1
old: 11.0
new: 18.0
path: .spaces[2].metrics.halstead.length
old: 58.0
new: 123.0
path: .spaces[2].metrics.halstead.time
old: 118.529146726006
new: 680.7791761249251
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 7.0
path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 7.0
Code
nsresult nsAppFileLocationProvider::GetDefaultUserProfileRoot(
nsIFile** aLocalFile, bool aLocal) {
if (NS_WARN_IF(!aLocalFile)) {
return NS_ERROR_INVALID_ARG;
}
nsresult rv;
nsCOMPtr localDir;
rv = GetProductDirectory(getter_AddRefs(localDir), aLocal);
if (NS_FAILED(rv)) {
return rv;
}
#if defined(MOZ_WIDGET_COCOA) || defined(XP_WIN)
// These 3 platforms share this part of the path - do them as one
rv = localDir->AppendRelativeNativePath("Profiles"_ns);
if (NS_FAILED(rv)) {
return rv;
}
bool exists;
rv = localDir->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists) {
rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0775);
}
if (NS_FAILED(rv)) {
return rv;
}
#endif
localDir.forget(aLocalFile);
return rv;
}
Minimal test - lines (406, 431)
path: .spaces[4].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[4].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[4].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[4].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[4].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[4].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[4].metrics.mi.mi_visual_studio
old: 57.3011325093952
new: 49.78502353967481
path: .spaces[4].metrics.mi.mi_original
old: 97.9849365910658
new: 85.13239025284392
path: .spaces[4].metrics.mi.mi_sei
old: 65.76334996914186
new: 47.42468482300251
path: .spaces[4].metrics.halstead.bugs
old: 0.04240986217448183
new: 0.1026129329747968
path: .spaces[4].metrics.halstead.time
old: 79.72777947550486
new: 300.0630564912806
path: .spaces[4].metrics.halstead.volume
old: 212.6074119346796
new: 507.79901867755166
path: .spaces[4].metrics.halstead.effort
old: 1435.1000305590874
new: 5401.13501684305
path: .spaces[4].metrics.halstead.length
old: 47.0
new: 99.0
path: .spaces[4].metrics.halstead.n1
old: 9.0
new: 13.0
path: .spaces[4].metrics.halstead.n2
old: 14.0
new: 22.0
path: .spaces[4].metrics.halstead.N2
old: 21.0
new: 36.0
path: .spaces[4].metrics.halstead.vocabulary
old: 23.0
new: 35.0
path: .spaces[4].metrics.halstead.level
old: 0.14814814814814814
new: 0.09401709401709402
path: .spaces[4].metrics.halstead.difficulty
old: 6.75
new: 10.636363636363637
path: .spaces[4].metrics.halstead.purity_ratio
old: 1.7411126366337717
new: 1.4769011307662094
path: .spaces[4].metrics.halstead.N1
old: 26.0
new: 63.0
path: .spaces[4].metrics.halstead.estimated_program_length
old: 81.83229392178727
new: 146.21321194585474
path: .spaces[4].metrics.loc.blank
old: 3.0
new: 1.0
path: .spaces[4].metrics.loc.lloc
old: 7.0
new: 8.0
path: .spaces[4].metrics.loc.ploc
old: 13.0
new: 25.0
path: .spaces[4].metrics.loc.sloc
old: 16.0
new: 26.0
path: .spaces[4].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[4].metrics.nargs.sum
old: 0.0
new: 2.0
Code
nsAppFileLocationProvider::GetFiles(const char* aProp,
nsISimpleEnumerator** aResult) {
if (NS_WARN_IF(!aResult)) {
return NS_ERROR_INVALID_ARG;
}
*aResult = nullptr;
nsresult rv = NS_ERROR_FAILURE;
if (!nsCRT::strcmp(aProp, NS_APP_PLUGINS_DIR_LIST)) {
#ifdef MOZ_WIDGET_COCOA
static const char* keys[] = {NS_MACOSX_USER_PLUGIN_DIR,
NS_MACOSX_LOCAL_PLUGIN_DIR, nullptr};
#else
# ifdef XP_UNIX
static const char* keys[] = {NS_USER_PLUGINS_DIR, NS_SYSTEM_PLUGINS_DIR,
nullptr};
# else
static const char* keys[] = {NS_USER_PLUGINS_DIR, nullptr};
# endif
#endif
*aResult = new nsAppDirectoryEnumerator(this, keys);
NS_ADDREF(*aResult);
rv = NS_OK;
}
return rv;
}
Minimal test - lines (356, 403)
path: .spaces[3].metrics.nexits.average
old: 0.0
new: 1.25
path: .spaces[3].metrics.nexits.sum
old: 0.0
new: 5.0
path: .spaces[3].metrics.loc.lloc
old: 29.0
new: 16.0
path: .spaces[3].metrics.loc.cloc
old: 1.0
new: 4.0
path: .spaces[3].metrics.loc.ploc
old: 40.0
new: 37.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.377766039383949
new: 1.3876197305776996
path: .spaces[3].metrics.halstead.difficulty
old: 11.916666666666666
new: 23.53448275862069
path: .spaces[3].metrics.halstead.bugs
old: 0.1852880500177585
new: 0.26420355946931096
path: .spaces[3].metrics.halstead.time
old: 728.0823333355888
new: 1239.7022044436203
path: .spaces[3].metrics.halstead.vocabulary
old: 53.0
new: 50.0
path: .spaces[3].metrics.halstead.effort
old: 13105.4820000406
new: 22314.63967998517
path: .spaces[3].metrics.halstead.N2
old: 91.0
new: 65.0
path: .spaces[3].metrics.halstead.length
old: 192.0
new: 168.0
path: .spaces[3].metrics.halstead.level
old: 0.08391608391608392
new: 0.04249084249084249
path: .spaces[3].metrics.halstead.n1
old: 11.0
new: 21.0
path: .spaces[3].metrics.halstead.volume
old: 1099.7607272761345
new: 948.1678398821535
path: .spaces[3].metrics.halstead.N1
old: 101.0
new: 103.0
path: .spaces[3].metrics.halstead.estimated_program_length
old: 264.53107956171823
new: 233.1201147370535
path: .spaces[3].metrics.halstead.n2
old: 42.0
new: 29.0
path: .spaces[3].metrics.cognitive.sum
old: 0.0
new: 4.0
path: .spaces[3].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[3].metrics.nargs.sum
old: 0.0
new: 4.0
path: .spaces[3].metrics.nargs.average
old: 0.0
new: 1.0
path: .spaces[3].metrics.nom.total
old: 1.0
new: 4.0
path: .spaces[3].metrics.nom.functions
old: 1.0
new: 4.0
path: .spaces[3].metrics.mi.mi_original
old: 71.64173446806194
new: 70.34297965235064
path: .spaces[3].metrics.mi.mi_sei
old: 38.84554594023501
new: 48.42355645552492
path: .spaces[3].metrics.mi.mi_visual_studio
old: 41.89575115091341
new: 41.13624541073136
path: .spaces[3].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[3].metrics.cyclomatic.sum
old: 1.0
new: 10.0
Code
class nsAppDirectoryEnumerator : public nsSimpleEnumerator {
public:
/**
* aKeyList is a null-terminated list of properties which are provided by
* aProvider They do not need to be publicly defined keys.
*/
nsAppDirectoryEnumerator(nsIDirectoryServiceProvider* aProvider,
const char* aKeyList[])
: mProvider(aProvider), mCurrentKey(aKeyList) {}
const nsID& DefaultInterface() override { return NS_GET_IID(nsIFile); }
NS_IMETHOD HasMoreElements(bool* aResult) override {
while (!mNext && *mCurrentKey) {
bool dontCare;
nsCOMPtr testFile;
(void)mProvider->GetFile(*mCurrentKey++, &dontCare,
getter_AddRefs(testFile));
mNext = testFile;
}
*aResult = mNext != nullptr;
return NS_OK;
}
NS_IMETHOD GetNext(nsISupports** aResult) override {
if (NS_WARN_IF(!aResult)) {
return NS_ERROR_INVALID_ARG;
}
*aResult = nullptr;
bool hasMore;
HasMoreElements(&hasMore);
if (!hasMore) {
return NS_ERROR_FAILURE;
}
*aResult = mNext;
NS_IF_ADDREF(*aResult);
mNext = nullptr;
return *aResult ? NS_OK : NS_ERROR_FAILURE;
}
protected:
nsCOMPtr mProvider;
const char** mCurrentKey;
nsCOMPtr mNext;
};
Minimal test - lines (240, 306)
path: .spaces[1].metrics.cyclomatic.sum
old: 4.0
new: 14.0
path: .spaces[1].metrics.cyclomatic.average
old: 4.0
new: 14.0
path: .spaces[1].metrics.loc.sloc
old: 113.0
new: 67.0
path: .spaces[1].metrics.loc.ploc
old: 88.0
new: 60.0
path: .spaces[1].metrics.loc.blank
old: 25.0
new: 7.0
path: .spaces[1].metrics.loc.lloc
old: 31.0
new: 28.0
path: .spaces[1].metrics.cognitive.average
old: 3.0
new: 11.0
path: .spaces[1].metrics.cognitive.sum
old: 3.0
new: 11.0
path: .spaces[1].metrics.mi.mi_original
old: 53.75002967574919
new: 61.0052626805674
path: .spaces[1].metrics.mi.mi_sei
old: 2.251328706443033
new: 13.736615977032857
path: .spaces[1].metrics.mi.mi_visual_studio
old: 31.43276589225099
new: 35.67559221085813
path: .spaces[1].metrics.halstead.time
old: 2347.9547136552023
new: 1818.6097158575235
path: .spaces[1].metrics.halstead.volume
old: 2087.070856582402
new: 1693.1883561432116
path: .spaces[1].metrics.halstead.length
old: 361.0
new: 271.0
path: .spaces[1].metrics.halstead.n1
old: 11.0
new: 19.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 0.7708275319253499
new: 1.5246692013388132
path: .spaces[1].metrics.halstead.N1
old: 199.0
new: 155.0
path: .spaces[1].metrics.halstead.level
old: 0.04938271604938271
new: 0.05172413793103449
path: .spaces[1].metrics.halstead.estimated_program_length
old: 278.26873902505133
new: 413.1853535628184
path: .spaces[1].metrics.halstead.vocabulary
old: 55.0
new: 76.0
path: .spaces[1].metrics.halstead.difficulty
old: 20.25
new: 19.333333333333332
path: .spaces[1].metrics.halstead.n2
old: 44.0
new: 57.0
path: .spaces[1].metrics.halstead.bugs
old: 0.4044394950223365
new: 0.3411039537192685
path: .spaces[1].metrics.halstead.N2
old: 162.0
new: 116.0
path: .spaces[1].metrics.halstead.effort
old: 42263.18484579364
new: 32734.974885435426
path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 10.0
path: .spaces[1].metrics.nexits.average
old: 0.0
new: 10.0
path: .spaces[1].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[1].metrics.nargs.sum
old: 0.0
new: 2.0
Code
nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
bool aLocal) {
if (NS_WARN_IF(!aLocalFile)) {
return NS_ERROR_INVALID_ARG;
}
nsresult rv;
bool exists;
nsCOMPtr localDir;
#if defined(MOZ_WIDGET_COCOA)
FSRef fsRef;
OSType folderType =
aLocal ? (OSType)kCachedDataFolderType : (OSType)kDomainLibraryFolderType;
OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
if (err) {
return NS_ERROR_FAILURE;
}
NS_NewLocalFile(u""_ns, true, getter_AddRefs(localDir));
if (!localDir) {
return NS_ERROR_FAILURE;
}
nsCOMPtr localDirMac(do_QueryInterface(localDir));
rv = localDirMac->InitWithFSRef(&fsRef);
if (NS_FAILED(rv)) {
return rv;
}
#elif defined(XP_WIN)
nsCOMPtr directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
return rv;
}
const char* prop = aLocal ? NS_WIN_LOCAL_APPDATA_DIR : NS_WIN_APPDATA_DIR;
rv = directoryService->Get(prop, NS_GET_IID(nsIFile),
getter_AddRefs(localDir));
if (NS_FAILED(rv)) {
return rv;
}
#elif defined(XP_UNIX)
rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true,
getter_AddRefs(localDir));
if (NS_FAILED(rv)) {
return rv;
}
#else
# error dont_know_how_to_get_product_dir_on_your_platform
#endif
rv = localDir->AppendRelativeNativePath(DEFAULT_PRODUCT_DIR);
if (NS_FAILED(rv)) {
return rv;
}
rv = localDir->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists) {
rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
}
if (NS_FAILED(rv)) {
return rv;
}
localDir.forget(aLocalFile);
return rv;
}
Minimal test - lines (193, 230)
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 5.0
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 5.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 10.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 10.0
path: .spaces[0].metrics.loc.lloc
old: 22.0
new: 15.0
path: .spaces[0].metrics.loc.cloc
old: 1.0
new: 4.0
path: .spaces[0].metrics.loc.sloc
old: 37.0
new: 38.0
path: .spaces[0].metrics.loc.blank
old: 6.0
new: 4.0
path: .spaces[0].metrics.mi.mi_sei
old: 49.154530841432134
new: 59.50425162703069
path: .spaces[0].metrics.mi.mi_original
old: 77.74095786198464
new: 76.52760849559937
path: .spaces[0].metrics.mi.mi_visual_studio
old: 45.46254845730096
new: 44.75298742432712
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 7.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 7.0
path: .spaces[0].metrics.halstead.level
old: 0.106280193236715
new: 0.05974025974025974
path: .spaces[0].metrics.halstead.effort
old: 7204.626287507222
new: 11423.425238934611
path: .spaces[0].metrics.halstead.time
old: 400.25701597262344
new: 634.6347354963674
path: .spaces[0].metrics.halstead.n2
old: 33.0
new: 23.0
path: .spaces[0].metrics.halstead.volume
old: 765.709074034584
new: 682.4383908973924
path: .spaces[0].metrics.halstead.bugs
old: 0.12434253509723003
new: 0.1690737977009159
path: .spaces[0].metrics.halstead.length
old: 142.0
new: 131.0
path: .spaces[0].metrics.halstead.difficulty
old: 9.409090909090908
new: 16.73913043478261
path: .spaces[0].metrics.halstead.N2
old: 69.0
new: 55.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.3731995137451394
new: 1.201106060290975
path: .spaces[0].metrics.halstead.n1
old: 9.0
new: 14.0
path: .spaces[0].metrics.halstead.vocabulary
old: 42.0
new: 37.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 194.9943309518098
new: 157.34489389811776
path: .spaces[0].metrics.halstead.N1
old: 73.0
new: 76.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: 0.0
new: 1.0
Code
nsresult nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile** aLocalFile) {
if (NS_WARN_IF(!aLocalFile)) {
return NS_ERROR_INVALID_ARG;
}
nsresult rv;
if (!mMozBinDirectory) {
// Get the mozilla bin directory
// 1. Check the directory service first for NS_XPCOM_CURRENT_PROCESS_DIR
// This will be set if a directory was passed to NS_InitXPCOM
// 2. If that doesn't work, set it to be the current process directory
nsCOMPtr directoryService(
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
return rv;
}
rv =
directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(mMozBinDirectory));
if (NS_FAILED(rv)) {
rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(mMozBinDirectory));
if (NS_FAILED(rv)) {
return rv;
}
}
}
nsCOMPtr aFile;
rv = mMozBinDirectory->Clone(getter_AddRefs(aFile));
if (NS_FAILED(rv)) {
return rv;
}
NS_IF_ADDREF(*aLocalFile = aFile);
return NS_OK;
}