Global Metrics
path: .metrics.nexits.average
old: 1.0
new: 0.6
path: .metrics.nexits.sum
old: 9.0
new: 3.0
path: .metrics.nargs.average
old: 0.8888888888888888
new: 0.2
path: .metrics.nargs.sum
old: 8.0
new: 1.0
path: .metrics.cognitive.sum
old: 13.0
new: 1.0
path: .metrics.cognitive.average
old: 1.4444444444444444
new: 0.2
path: .metrics.nom.functions
old: 9.0
new: 5.0
path: .metrics.nom.total
old: 9.0
new: 5.0
path: .metrics.cyclomatic.sum
old: 40.0
new: 13.0
path: .metrics.cyclomatic.average
old: 1.6666666666666667
new: 1.181818181818182
path: .metrics.halstead.purity_ratio
old: 1.343212051114017
new: 1.3773684526649923
path: .metrics.halstead.N2
old: 869.0
new: 96.0
path: .metrics.halstead.effort
old: 786355.4349878789
new: 28792.83172085128
path: .metrics.halstead.length
old: 1969.0
new: 228.0
path: .metrics.halstead.n1
old: 33.0
new: 19.0
path: .metrics.halstead.estimated_program_length
old: 2644.7845286434995
new: 314.0400072076183
path: .metrics.halstead.vocabulary
old: 334.0
new: 62.0
path: .metrics.halstead.bugs
old: 2.839823446143607
new: 0.31313744087064693
path: .metrics.halstead.volume
old: 16507.513751881408
new: 1357.5567587682074
path: .metrics.halstead.level
old: 0.02099243296021202
new: 0.047149122807017545
path: .metrics.halstead.N1
old: 1100.0
new: 132.0
path: .metrics.halstead.n2
old: 301.0
new: 43.0
path: .metrics.halstead.difficulty
old: 47.636212624584715
new: 21.20930232558139
path: .metrics.halstead.time
old: 43686.41305488216
new: 1599.6017622695156
path: .metrics.loc.ploc
old: 192.0
new: 48.0
path: .metrics.loc.lloc
old: 72.0
new: 4.0
path: .metrics.loc.blank
old: 52.0
new: 25.0
path: .metrics.loc.sloc
old: 344.0
new: 140.0
path: .metrics.loc.cloc
old: 100.0
new: 67.0
path: .metrics.mi.mi_visual_studio
old: 9.755225899320576
new: 29.50028951484583
path: .metrics.mi.mi_sei
old: -10.487978288904692
new: 42.30138509362106
path: .metrics.mi.mi_original
old: 16.68143628783818
new: 50.44549507038637
Spaces Data
Minimal test - lines (18, 138)
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 1.25
path: .spaces[2].metrics.cyclomatic.sum
old: 3.0
new: 10.0
path: .spaces[2].metrics.loc.lloc
old: 3.0
new: 4.0
path: .spaces[2].metrics.loc.ploc
old: 5.0
new: 39.0
path: .spaces[2].metrics.loc.sloc
old: 5.0
new: 121.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 22.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 60.0
path: .spaces[2].metrics.nom.total
old: 1.0
new: 5.0
path: .spaces[2].metrics.nom.functions
old: 1.0
new: 5.0
path: .spaces[2].metrics.nexits.sum
old: 1.0
new: 3.0
path: .spaces[2].metrics.nexits.average
old: 1.0
new: 0.6
path: .spaces[2].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.nargs.average
old: 0.0
new: 0.2
path: .spaces[2].metrics.halstead.estimated_program_length
old: 66.58307281799108
new: 280.13186826628436
path: .spaces[2].metrics.halstead.n2
old: 9.0
new: 38.0
path: .spaces[2].metrics.halstead.bugs
old: 0.05168392346661246
new: 0.3071760747696123
path: .spaces[2].metrics.halstead.time
old: 107.2611846018188
new: 1554.141139329672
path: .spaces[2].metrics.halstead.effort
old: 1930.7013228327385
new: 27974.5405079341
path: .spaces[2].metrics.halstead.length
old: 43.0
new: 218.0
path: .spaces[2].metrics.halstead.n1
old: 11.0
new: 19.0
path: .spaces[2].metrics.halstead.vocabulary
old: 20.0
new: 57.0
path: .spaces[2].metrics.halstead.level
old: 0.0962566844919786
new: 0.045454545454545456
path: .spaces[2].metrics.halstead.volume
old: 185.8429080801566
new: 1271.5700230879136
path: .spaces[2].metrics.halstead.difficulty
old: 10.38888888888889
new: 22.0
path: .spaces[2].metrics.halstead.N2
old: 17.0
new: 88.0
path: .spaces[2].metrics.halstead.N1
old: 26.0
new: 130.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.5484435539067694
new: 1.2850085700288274
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 0.2
path: .spaces[2].metrics.mi.mi_original
old: 117.06761678803866
new: 53.83855335746101
path: .spaces[2].metrics.mi.mi_visual_studio
old: 68.46059461288812
new: 31.48453412717018
path: .spaces[2].metrics.mi.mi_sei
old: 93.4974777749936
new: 47.34231000244954
Code
namespace mozilla {
class FileLocation {
public:
/**
* FileLocation is an helper to handle different kind of file locations
* within Gecko:
* - on filesystems
* - in archives
* - in archives within archives
* As such, it stores a path within an archive, as well as the archive
* path itself, or the complete file path alone when on a filesystem.
* When the archive is in an archive, an nsZipArchive is stored instead
* of a file path.
*/
FileLocation();
~FileLocation();
FileLocation(const FileLocation& aOther);
FileLocation(FileLocation&& aOther);
FileLocation& operator=(const FileLocation&) = default;
/**
* Constructor for plain files
*/
explicit FileLocation(nsIFile* aFile);
/**
* Constructors for path within an archive. The archive can be given either
* as nsIFile or nsZipArchive.
*/
FileLocation(nsIFile* aZip, const char* aPath);
FileLocation(nsZipArchive* aZip, const char* aPath);
/**
* Creates a new file location relative to another one.
*/
FileLocation(const FileLocation& aFile, const char* aPath);
/**
* Initialization functions corresponding to constructors
*/
void Init(nsIFile* aFile);
void Init(nsIFile* aZip, const char* aPath);
void Init(nsZipArchive* aZip, const char* aPath);
/**
* Returns an URI string corresponding to the file location
*/
void GetURIString(nsACString& aResult) const;
/**
* Returns the base file of the location, where base file is defined as:
* - The file itself when the location is on a filesystem
* - The archive file when the location is in an archive
* - The outer archive file when the location is in an archive in an archive
*/
already_AddRefed GetBaseFile();
nsZipArchive* GetBaseZip() { return mBaseZip; }
/**
* Returns whether the "base file" (see GetBaseFile) is an archive
*/
bool IsZip() const { return !mPath.IsEmpty(); }
/**
* Returns the path within the archive, when within an archive
*/
void GetPath(nsACString& aResult) const { aResult = mPath; }
/**
* Boolean value corresponding to whether the file location is initialized
* or not.
*/
explicit operator bool() const { return mBaseFile || mBaseZip; }
/**
* Returns whether another FileLocation points to the same resource
*/
bool Equals(const FileLocation& aFile) const;
/**
* Data associated with a FileLocation.
*/
class Data {
public:
/**
* Returns the data size
*/
nsresult GetSize(uint32_t* aResult);
/**
* Copies the data in the given buffer
*/
nsresult Copy(char* aBuf, uint32_t aLen);
protected:
friend class FileLocation;
nsZipItem* mItem;
RefPtr mZip;
mozilla::AutoFDClose mFd;
};
/**
* Returns the data associated with the resource pointed at by the file
* location.
*/
nsresult GetData(Data& aData);
private:
nsCOMPtr mBaseFile;
RefPtr mBaseZip;
nsCString mPath;
}; /* class FileLocation */
} /* namespace mozilla */
Minimal test - lines (15, 15)
path: .spaces[0].metrics.loc.blank
old: 1.0
new: 0.0
path: .spaces[0].metrics.loc.ploc
old: 5.0
new: 1.0
path: .spaces[0].metrics.loc.sloc
old: 6.0
new: 1.0
path: .spaces[0].metrics.halstead.N1
old: 13.0
new: 0.0
path: .spaces[0].metrics.halstead.bugs
old: 0.013503992939902846
new: 0.0
path: .spaces[0].metrics.halstead.n1
old: 6.0
new: 0.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 2.0017772735139885
new: null
path: .spaces[0].metrics.halstead.vocabulary
old: 15.0
new: 1.0
path: .spaces[0].metrics.halstead.difficulty
old: 3.0
new: 0.0
path: .spaces[0].metrics.halstead.effort
old: 257.85477931016226
new: 0.0
path: .spaces[0].metrics.halstead.n2
old: 9.0
new: 1.0
path: .spaces[0].metrics.halstead.level
old: 0.3333333333333333
new: null
path: .spaces[0].metrics.halstead.time
old: 14.325265517231236
new: 0.0
path: .spaces[0].metrics.halstead.volume
old: 85.95159310338741
new: 0.0
path: .spaces[0].metrics.halstead.length
old: 22.0
new: 1.0
path: .spaces[0].metrics.halstead.N2
old: 9.0
new: 1.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 44.039100017307746
new: null
path: .spaces[0].metrics.mi.mi_original
old: 118.58381841067036
new: null
path: .spaces[0].metrics.mi.mi_sei
old: 95.48125461814324
new: null
path: .spaces[0].metrics.mi.mi_visual_studio
old: 69.34726222846221
new: null
Code
class nsZipArchive;
Minimal test - lines (20, 136)
path: .spaces[2].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.2857142857142858
path: .spaces[2].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 9.0
path: .spaces[2].spaces[0].metrics.mi.mi_sei
old: null
new: 48.70551733554267
path: .spaces[2].spaces[0].metrics.mi.mi_original
old: null
new: 54.708013448093254
path: .spaces[2].spaces[0].metrics.mi.mi_visual_studio
old: null
new: 31.99299032052237
path: .spaces[2].spaces[0].metrics.nexits.average
old: null
new: 0.6
path: .spaces[2].spaces[0].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[2].spaces[0].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[2].spaces[0].metrics.nargs.average
old: null
new: 0.2
path: .spaces[2].spaces[0].metrics.cognitive.average
old: null
new: 0.2
path: .spaces[2].spaces[0].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[2].spaces[0].metrics.nom.functions
old: 0.0
new: 5.0
path: .spaces[2].spaces[0].metrics.nom.total
old: 0.0
new: 5.0
path: .spaces[2].spaces[0].metrics.halstead.N2
old: 1.0
new: 87.0
path: .spaces[2].spaces[0].metrics.halstead.difficulty
old: 0.0
new: 22.33783783783784
path: .spaces[2].spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 56.0
path: .spaces[2].spaces[0].metrics.halstead.n2
old: 1.0
new: 37.0
path: .spaces[2].spaces[0].metrics.halstead.n1
old: 0.0
new: 19.0
path: .spaces[2].spaces[0].metrics.halstead.time
old: 0.0
new: 1549.478155048545
path: .spaces[2].spaces[0].metrics.halstead.level
old: null
new: 0.04476709013914095
path: .spaces[2].spaces[0].metrics.halstead.volume
old: 0.0
new: 1248.5813082423847
path: .spaces[2].spaces[0].metrics.halstead.effort
old: 0.0
new: 27890.60679087381
path: .spaces[2].spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.30656134105657123
path: .spaces[2].spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.2719088245753456
path: .spaces[2].spaces[0].metrics.halstead.length
old: 1.0
new: 215.0
path: .spaces[2].spaces[0].metrics.halstead.estimated_program_length
old: null
new: 273.4603972836993
path: .spaces[2].spaces[0].metrics.halstead.N1
old: 0.0
new: 128.0
path: .spaces[2].spaces[0].metrics.loc.cloc
old: 0.0
new: 59.0
path: .spaces[2].spaces[0].metrics.loc.blank
old: 0.0
new: 21.0
path: .spaces[2].spaces[0].metrics.loc.sloc
old: 1.0
new: 117.0
path: .spaces[2].spaces[0].metrics.loc.lloc
old: 0.0
new: 4.0
path: .spaces[2].spaces[0].metrics.loc.ploc
old: 1.0
new: 37.0
Code
class FileLocation {
public:
/**
* FileLocation is an helper to handle different kind of file locations
* within Gecko:
* - on filesystems
* - in archives
* - in archives within archives
* As such, it stores a path within an archive, as well as the archive
* path itself, or the complete file path alone when on a filesystem.
* When the archive is in an archive, an nsZipArchive is stored instead
* of a file path.
*/
FileLocation();
~FileLocation();
FileLocation(const FileLocation& aOther);
FileLocation(FileLocation&& aOther);
FileLocation& operator=(const FileLocation&) = default;
/**
* Constructor for plain files
*/
explicit FileLocation(nsIFile* aFile);
/**
* Constructors for path within an archive. The archive can be given either
* as nsIFile or nsZipArchive.
*/
FileLocation(nsIFile* aZip, const char* aPath);
FileLocation(nsZipArchive* aZip, const char* aPath);
/**
* Creates a new file location relative to another one.
*/
FileLocation(const FileLocation& aFile, const char* aPath);
/**
* Initialization functions corresponding to constructors
*/
void Init(nsIFile* aFile);
void Init(nsIFile* aZip, const char* aPath);
void Init(nsZipArchive* aZip, const char* aPath);
/**
* Returns an URI string corresponding to the file location
*/
void GetURIString(nsACString& aResult) const;
/**
* Returns the base file of the location, where base file is defined as:
* - The file itself when the location is on a filesystem
* - The archive file when the location is in an archive
* - The outer archive file when the location is in an archive in an archive
*/
already_AddRefed GetBaseFile();
nsZipArchive* GetBaseZip() { return mBaseZip; }
/**
* Returns whether the "base file" (see GetBaseFile) is an archive
*/
bool IsZip() const { return !mPath.IsEmpty(); }
/**
* Returns the path within the archive, when within an archive
*/
void GetPath(nsACString& aResult) const { aResult = mPath; }
/**
* Boolean value corresponding to whether the file location is initialized
* or not.
*/
explicit operator bool() const { return mBaseFile || mBaseZip; }
/**
* Returns whether another FileLocation points to the same resource
*/
bool Equals(const FileLocation& aFile) const;
/**
* Data associated with a FileLocation.
*/
class Data {
public:
/**
* Returns the data size
*/
nsresult GetSize(uint32_t* aResult);
/**
* Copies the data in the given buffer
*/
nsresult Copy(char* aBuf, uint32_t aLen);
protected:
friend class FileLocation;
nsZipItem* mItem;
RefPtr mZip;
mozilla::AutoFDClose mFd;
};
/**
* Returns the data associated with the resource pointed at by the file
* location.
*/
nsresult GetData(Data& aData);
private:
nsCOMPtr mBaseFile;
RefPtr mBaseZip;
nsCString mPath;
}; /* class FileLocation */
Minimal test - lines (16, 16)
path: .spaces[1].metrics.halstead.N2
old: 3.0
new: 1.0
path: .spaces[1].metrics.halstead.vocabulary
old: 7.0
new: 1.0
path: .spaces[1].metrics.halstead.effort
old: 39.302968908806456
new: 0.0
path: .spaces[1].metrics.halstead.n1
old: 4.0
new: 0.0
path: .spaces[1].metrics.halstead.bugs
old: 0.0038532659414573967
new: 0.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.8221267860233523
new: null
path: .spaces[1].metrics.halstead.volume
old: 19.651484454403228
new: 0.0
path: .spaces[1].metrics.halstead.difficulty
old: 2.0
new: 0.0
path: .spaces[1].metrics.halstead.level
old: 0.5
new: null
path: .spaces[1].metrics.halstead.estimated_program_length
old: 12.754887502163468
new: null
path: .spaces[1].metrics.halstead.time
old: 2.1834982727114696
new: 0.0
path: .spaces[1].metrics.halstead.length
old: 7.0
new: 1.0
path: .spaces[1].metrics.halstead.n2
old: 3.0
new: 1.0
path: .spaces[1].metrics.halstead.N1
old: 4.0
new: 0.0
path: .spaces[1].metrics.loc.sloc
old: 3.0
new: 1.0
path: .spaces[1].metrics.loc.ploc
old: 3.0
new: 1.0
path: .spaces[1].metrics.mi.mi_visual_studio
old: 80.40121985172942
new: null
path: .spaces[1].metrics.mi.mi_sei
old: 122.75146225357946
new: null
path: .spaces[1].metrics.mi.mi_original
old: 137.4860859464573
new: null
Code
class nsZipItem;