Global Metrics
path: .metrics.mi.mi_original
old: 69.82968013256595
new: 27.380885501954698
path: .metrics.mi.mi_visual_studio
old: 40.83607025296255
new: 16.012213743833154
path: .metrics.mi.mi_sei
old: 57.71106001420094
new: -10.049170421489531
path: .metrics.cognitive.sum
old: 1.0
new: 19.0
path: .metrics.cognitive.average
old: 1.0
new: 1.5833333333333333
path: .metrics.halstead.bugs
old: 0.1232179160211762
new: 1.5085021383506965
path: .metrics.halstead.N2
old: 64.0
new: 343.0
path: .metrics.halstead.n2
old: 34.0
new: 108.0
path: .metrics.halstead.estimated_program_length
old: 211.0274844075218
new: 876.7345681019101
path: .metrics.halstead.time
old: 394.8391115008263
new: 16913.29688208909
path: .metrics.halstead.length
old: 125.0
new: 899.0
path: .metrics.halstead.n1
old: 11.0
new: 30.0
path: .metrics.halstead.vocabulary
old: 45.0
new: 138.0
path: .metrics.halstead.N1
old: 61.0
new: 556.0
path: .metrics.halstead.effort
old: 7107.104007014873
new: 304439.3438776036
path: .metrics.halstead.level
old: 0.09659090909090907
new: 0.02099125364431487
path: .metrics.halstead.volume
old: 686.4816370412093
new: 6390.563486643574
path: .metrics.halstead.purity_ratio
old: 1.6882198752601745
new: 0.9752331124604116
path: .metrics.halstead.difficulty
old: 10.352941176470589
new: 47.638888888888886
path: .metrics.cyclomatic.average
old: 1.25
new: 2.5
path: .metrics.cyclomatic.sum
old: 5.0
new: 40.0
path: .metrics.loc.cloc
old: 12.0
new: 21.0
path: .metrics.loc.lloc
old: 2.0
new: 85.0
path: .metrics.loc.ploc
old: 33.0
new: 181.0
path: .metrics.loc.blank
old: 14.0
new: 39.0
path: .metrics.loc.sloc
old: 59.0
new: 241.0
path: .metrics.nargs.average
old: 1.0
new: 3.25
path: .metrics.nargs.sum
old: 1.0
new: 39.0
path: .metrics.nexits.average
old: 1.0
new: 2.0
path: .metrics.nexits.sum
old: 1.0
new: 24.0
path: .metrics.nom.total
old: 1.0
new: 12.0
path: .metrics.nom.functions
old: 1.0
new: 12.0
Spaces Data
Minimal test - lines (19, 31)
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.5700039463836086
new: 1.324979167067309
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 59.0
new: 16.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 41.0
new: 21.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 632.1911365449339
new: 237.1851408300531
path: .spaces[0].spaces[0].metrics.halstead.time
old: 379.90004409042785
new: 79.06171361001769
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 6838.200793627701
new: 1423.1108449803185
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 10.816666666666666
new: 6.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 185.26046567326583
new: 71.54887502163469
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.1200899446494644
new: 0.04217333031591035
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 11.0
new: 9.0
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 59.0
new: 38.0
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 30.0
new: 12.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 118.0
new: 54.0
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.09244992295839752
new: 0.16666666666666666
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 3.0
new: 0.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 39.0
new: 13.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 26.0
new: 12.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 10.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 2.0
new: 9.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 1.0
new: 5.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 1.0
new: 5.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 57.133047824872406
new: 68.87555349920412
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 45.27748776516838
new: 58.39757140314168
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 77.42450407843793
new: 99.85984709937227
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.5
new: 5.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 3.0
new: 5.0
Code
SnappyFrameUtils::ChunkType ReadChunkType(uint8_t aByte) {
if (aByte == 0xff) {
return SnappyFrameUtils::StreamIdentifier;
} else if (aByte == 0x00) {
return SnappyFrameUtils::CompressedData;
} else if (aByte == 0x01) {
return SnappyFrameUtils::UncompressedData;
} else if (aByte == 0xfe) {
return SnappyFrameUtils::Padding;
}
return SnappyFrameUtils::Reserved;
}
Minimal test - lines (14, 65)
path: .spaces[0].metrics.cyclomatic.average
old: 1.3333333333333333
new: 2.3333333333333335
path: .spaces[0].metrics.cyclomatic.sum
old: 4.0
new: 14.0
path: .spaces[0].metrics.nargs.average
old: 1.0
new: 1.4
path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 7.0
path: .spaces[0].metrics.nexits.sum
old: 1.0
new: 7.0
path: .spaces[0].metrics.nexits.average
old: 1.0
new: 1.4
path: .spaces[0].metrics.nom.total
old: 1.0
new: 5.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 5.0
path: .spaces[0].metrics.halstead.vocabulary
old: 42.0
new: 58.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 191.6338334270034
new: 285.8598074086035
path: .spaces[0].metrics.halstead.N1
old: 61.0
new: 152.0
path: .spaces[0].metrics.halstead.n1
old: 11.0
new: 20.0
path: .spaces[0].metrics.halstead.volume
old: 652.4704081562301
new: 1318.0457239037037
path: .spaces[0].metrics.halstead.time
old: 385.8695962214263
new: 1406.6862258036604
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.583750689479367
new: 1.2704880329271266
path: .spaces[0].metrics.halstead.n2
old: 31.0
new: 38.0
path: .spaces[0].metrics.halstead.level
old: 0.09393939393939396
new: 0.052054794520547946
path: .spaces[0].metrics.halstead.bugs
old: 0.12134469351272734
new: 0.2874254623329372
path: .spaces[0].metrics.halstead.effort
old: 6945.652731985674
new: 25320.35206446589
path: .spaces[0].metrics.halstead.difficulty
old: 10.64516129032258
new: 19.210526315789473
path: .spaces[0].metrics.halstead.length
old: 121.0
new: 225.0
path: .spaces[0].metrics.halstead.N2
old: 60.0
new: 73.0
path: .spaces[0].metrics.cognitive.sum
old: 1.0
new: 9.0
path: .spaces[0].metrics.cognitive.average
old: 1.0
new: 1.8
path: .spaces[0].metrics.loc.ploc
old: 28.0
new: 43.0
path: .spaces[0].metrics.loc.blank
old: 12.0
new: 8.0
path: .spaces[0].metrics.loc.lloc
old: 2.0
new: 23.0
path: .spaces[0].metrics.loc.cloc
old: 5.0
new: 1.0
path: .spaces[0].metrics.loc.sloc
old: 45.0
new: 52.0
path: .spaces[0].metrics.mi.mi_original
old: 74.71208557496543
new: 66.4135436459861
path: .spaces[0].metrics.mi.mi_sei
old: 57.18072503943608
new: 32.198401048925334
path: .spaces[0].metrics.mi.mi_visual_studio
old: 43.69127811401487
new: 38.83832961753573
Code
namespace {
using mozilla::NativeEndian;
using mozilla::detail::SnappyFrameUtils;
SnappyFrameUtils::ChunkType ReadChunkType(uint8_t aByte) {
if (aByte == 0xff) {
return SnappyFrameUtils::StreamIdentifier;
} else if (aByte == 0x00) {
return SnappyFrameUtils::CompressedData;
} else if (aByte == 0x01) {
return SnappyFrameUtils::UncompressedData;
} else if (aByte == 0xfe) {
return SnappyFrameUtils::Padding;
}
return SnappyFrameUtils::Reserved;
}
void WriteChunkType(char* aDest, SnappyFrameUtils::ChunkType aType) {
unsigned char* dest = reinterpret_cast(aDest);
if (aType == SnappyFrameUtils::StreamIdentifier) {
*dest = 0xff;
} else if (aType == SnappyFrameUtils::CompressedData) {
*dest = 0x00;
} else if (aType == SnappyFrameUtils::UncompressedData) {
*dest = 0x01;
} else if (aType == SnappyFrameUtils::Padding) {
*dest = 0xfe;
} else {
*dest = 0x02;
}
}
void WriteUInt24(char* aBuf, uint32_t aVal) {
MOZ_ASSERT(!(aVal & 0xff000000));
uint32_t tmp = NativeEndian::swapToLittleEndian(aVal);
memcpy(aBuf, &tmp, 3);
}
uint32_t ReadUInt24(const char* aBuf) {
uint32_t val = 0;
memcpy(&val, aBuf, 3);
return NativeEndian::swapFromLittleEndian(val);
}
// This mask is explicitly defined in the snappy framing_format.txt file.
uint32_t MaskChecksum(uint32_t aValue) {
return ((aValue >> 15) | (aValue << 17)) + 0xa282ead8;
}
} // namespace