Global Metrics
path: .metrics.cognitive.average
old: 5.6
new: 2.5
path: .metrics.cognitive.sum
old: 28.0
new: 5.0
path: .metrics.loc.sloc
old: 154.0
new: 51.0
path: .metrics.loc.lloc
old: 50.0
new: 14.0
path: .metrics.loc.cloc
old: 13.0
new: 11.0
path: .metrics.loc.blank
old: 33.0
new: 8.0
path: .metrics.loc.ploc
old: 108.0
new: 32.0
path: .metrics.cyclomatic.average
old: 3.857142857142857
new: 2.25
path: .metrics.cyclomatic.sum
old: 27.0
new: 9.0
path: .metrics.nexits.average
old: 2.6
new: 2.0
path: .metrics.nexits.sum
old: 13.0
new: 4.0
path: .metrics.nom.total
old: 5.0
new: 2.0
path: .metrics.nom.functions
old: 5.0
new: 2.0
path: .metrics.nargs.average
old: 0.4
new: 2.0
path: .metrics.nargs.sum
old: 2.0
new: 4.0
path: .metrics.mi.mi_sei
old: 9.258794820725136
new: 60.520883909959515
path: .metrics.mi.mi_visual_studio
old: 24.506345064866665
new: 41.48984060872713
path: .metrics.mi.mi_original
old: 41.90585006092199
new: 70.94762744092338
path: .metrics.halstead.n2
old: 36.0
new: 33.0
path: .metrics.halstead.estimated_program_length
old: 290.15922504123455
new: 209.48455594748285
path: .metrics.halstead.N2
old: 176.0
new: 51.0
path: .metrics.halstead.difficulty
old: 56.22222222222222
new: 9.272727272727272
path: .metrics.halstead.N1
old: 301.0
new: 82.0
path: .metrics.halstead.length
old: 477.0
new: 133.0
path: .metrics.halstead.bugs
old: 0.9732206921262984
new: 0.1193248154640406
path: .metrics.halstead.level
old: 0.017786561264822136
new: 0.10784313725490197
path: .metrics.halstead.n1
old: 23.0
new: 12.0
path: .metrics.halstead.time
old: 8764.48451654366
new: 376.2751469939817
path: .metrics.halstead.purity_ratio
old: 0.6083002621409529
new: 1.5750718492291944
path: .metrics.halstead.vocabulary
old: 59.0
new: 45.0
path: .metrics.halstead.volume
old: 2806.0207345455983
new: 730.4164618118467
path: .metrics.halstead.effort
old: 157760.72129778587
new: 6772.95264589167
Spaces Data
Minimal test - lines (11, 51)
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 4.0
path: .spaces[0].metrics.nexits.average
old: null
new: 2.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 70.16296580620595
new: 43.732965005243486
path: .spaces[0].metrics.mi.mi_original
old: 119.97867152861218
new: 74.78337015896636
path: .spaces[0].metrics.mi.mi_sei
old: 97.4936022941664
new: 60.93084941614128
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 8.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.6666666666666665
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 5.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 2.5
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 4.0
path: .spaces[0].metrics.nargs.average
old: null
new: 2.0
path: .spaces[0].metrics.halstead.length
old: 19.0
new: 132.0
path: .spaces[0].metrics.halstead.level
old: 0.4
new: 0.10666666666666667
path: .spaces[0].metrics.halstead.N2
old: 6.0
new: 50.0
path: .spaces[0].metrics.halstead.N1
old: 13.0
new: 82.0
path: .spaces[0].metrics.halstead.effort
old: 164.32300188527162
new: 6756.046628063656
path: .spaces[0].metrics.halstead.n2
old: 6.0
new: 32.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.4273376567770395
new: 1.5380268940049535
path: .spaces[0].metrics.halstead.volume
old: 65.72920075410865
new: 720.6449736601232
path: .spaces[0].metrics.halstead.time
old: 9.129055660292869
new: 375.3359237813142
path: .spaces[0].metrics.halstead.vocabulary
old: 11.0
new: 44.0
path: .spaces[0].metrics.halstead.difficulty
old: 2.5
new: 9.375
path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 12.0
path: .spaces[0].metrics.halstead.bugs
old: 0.01000025295021724
new: 0.11912616772191031
path: .spaces[0].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 203.01955000865388
path: .spaces[0].metrics.nom.total
old: 0.0
new: 2.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 2.0
path: .spaces[0].metrics.loc.ploc
old: 6.0
new: 29.0
path: .spaces[0].metrics.loc.sloc
old: 6.0
new: 41.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 6.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 14.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 6.0
Code
namespace mozilla {
static void AssignStdHandle(const char* aPath, const char* aMode, FILE* aStream,
DWORD aStdHandle) {
// Visual Studio's _fileno() returns -2 for the standard
// streams if they aren't associated with an output stream.
const int fd = _fileno(aStream);
if (fd == -2) {
freopen(aPath, aMode, aStream);
return;
}
if (fd < 0) {
return;
}
const HANDLE handle = reinterpret_cast(_get_osfhandle(fd));
if (handle == INVALID_HANDLE_VALUE) {
return;
}
const HANDLE oldHandle = GetStdHandle(aStdHandle);
if (handle == oldHandle) {
return;
}
SetStdHandle(aStdHandle, handle);
}
// This code attaches the process to the appropriate console.
void UseParentConsole() {
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
// Redirect the standard streams to the existing console, but
// only if they haven't been redirected to a valid file.
AssignStdHandle("CONOUT$", "w", stdout, STD_OUTPUT_HANDLE);
// There is no CONERR$, so use CONOUT$ for stderr as well.
AssignStdHandle("CONOUT$", "w", stderr, STD_ERROR_HANDLE);
AssignStdHandle("CONIN$", "r", stdin, STD_INPUT_HANDLE);
}
}
} // namespace mozilla