# Global Metrics

path: .metrics.nexits.sum
old: 4.0
new: 3.0
path: .metrics.nexits.average
old: 0.6666666666666666
new: 1.0
path: .metrics.loc.blank
old: 13.0
new: 10.0
path: .metrics.loc.cloc
old: 7.0
new: 28.0
path: .metrics.loc.lloc
old: 17.0
new: 3.0
path: .metrics.loc.ploc
old: 53.0
new: 31.0
path: .metrics.loc.sloc
old: 73.0
new: 69.0
path: .metrics.cognitive.average
old: 0.6666666666666666
new: 0.3333333333333333
path: .metrics.cognitive.sum
old: 4.0
new: 1.0
path: .metrics.mi.mi_visual_studio
old: 35.100477570267614
new: 39.255872033867334
path: .metrics.mi.mi_original
old: 60.021816645157614
new: 67.12754117791314
path: .metrics.mi.mi_sei
old: 35.394607083953986
new: 63.67351102340699
path: .metrics.cyclomatic.average
old: 1.75
new: 1.1428571428571428
path: .metrics.cyclomatic.sum
old: 14.0
new: 8.0
path: .metrics.nom.functions
old: 6.0
new: 3.0
path: .metrics.nom.total
old: 6.0
new: 3.0
path: .metrics.halstead.length
old: 253.0
new: 121.0
path: .metrics.halstead.N1
old: 144.0
new: 72.0
path: .metrics.halstead.purity_ratio
old: 1.5312299922947303
new: 1.2083736524450803
path: .metrics.halstead.time
old: 2045.3863948394085
new: 499.1789736074081
path: .metrics.halstead.estimated_program_length
old: 387.4011880505667
new: 146.21321194585474
path: .metrics.halstead.volume
old: 1566.0256133966443
new: 620.643245050341
path: .metrics.halstead.vocabulary
old: 73.0
new: 35.0
path: .metrics.halstead.bugs
old: 0.36890170057158994
new: 0.14406703046212668
path: .metrics.halstead.N2
old: 109.0
new: 49.0
path: .metrics.halstead.n1
old: 22.0
new: 13.0
path: .metrics.halstead.effort
old: 36816.95510710935
new: 8985.221524933346
path: .metrics.halstead.difficulty
old: 23.50980392156863
new: 14.477272727272728
path: .metrics.halstead.level
old: 0.042535446205170975
new: 0.06907378335949765
path: .metrics.halstead.n2
old: 51.0
new: 22.0
path: .metrics.nargs.sum
old: 9.0
new: 5.0
path: .metrics.nargs.average
old: 1.5
new: 1.6666666666666667

# Spaces Data

## Minimal test - lines (17, 67)

path: .spaces[0].metrics.nexits.sum
old: 4.0
new: 3.0
path: .spaces[0].metrics.nexits.average
old: 0.6666666666666666
new: 1.0
path: .spaces[0].metrics.cyclomatic.sum
old: 13.0
new: 7.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.8571428571428572
new: 1.1666666666666667
path: .spaces[0].metrics.loc.ploc
old: 48.0
new: 24.0
path: .spaces[0].metrics.loc.blank
old: 10.0
new: 6.0
path: .spaces[0].metrics.loc.sloc
old: 58.0
new: 51.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 21.0
path: .spaces[0].metrics.loc.lloc
old: 17.0
new: 3.0
path: .spaces[0].metrics.halstead.level
old: 0.04020979020979021
new: 0.07155635062611806
path: .spaces[0].metrics.halstead.vocabulary
old: 68.0
new: 33.0
path: .spaces[0].metrics.halstead.volume
old: 1509.6907846300842
new: 549.8389590100714
path: .spaces[0].metrics.halstead.difficulty
old: 24.869565217391305
new: 13.975
path: .spaces[0].metrics.halstead.N2
old: 104.0
new: 43.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 352.1913455886431
new: 134.54427823358145
path: .spaces[0].metrics.halstead.length
old: 248.0
new: 109.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.4201263935025932
new: 1.2343511764548758
path: .spaces[0].metrics.halstead.n1
old: 22.0
new: 13.0
path: .spaces[0].metrics.halstead.N1
old: 144.0
new: 66.0
path: .spaces[0].metrics.halstead.effort
old: 37545.35342645253
new: 7683.999452165748
path: .spaces[0].metrics.halstead.n2
old: 46.0
new: 20.0
path: .spaces[0].metrics.halstead.time
old: 2085.8529681362515
new: 426.8888584536527
path: .spaces[0].metrics.halstead.bugs
old: 0.3737514416411171
new: 0.12979868584100096
path: .spaces[0].metrics.mi.mi_sei
old: 18.198513548742824
new: 72.07524511650008
path: .spaces[0].metrics.mi.mi_visual_studio
old: 37.52549155018516
new: 42.62244005578735
path: .spaces[0].metrics.mi.mi_original
old: 64.16859055081662
new: 72.88437249539638
path: .spaces[0].metrics.cognitive.sum
old: 4.0
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: 0.6666666666666666
new: 0.3333333333333333
path: .spaces[0].metrics.nargs.average
old: 1.5
new: 1.6666666666666667
path: .spaces[0].metrics.nargs.sum
old: 9.0
new: 5.0
path: .spaces[0].metrics.nom.functions
old: 6.0
new: 3.0
path: .spaces[0].metrics.nom.total
old: 6.0
new: 3.0

### Code

    namespace mozilla {

    // Boolean arrays, fixed size and filled in at compile time, meant to
    // record something about each of the (standard) ASCII characters.
    // No extended ASCII for now, there has been no use case.
    // If you have loops that go through a string character by character
    // and test for equality to a certain set of characters before deciding
    // on a course of action, chances are building up one of these arrays
    // and using it is going to be faster, especially if the set of
    // characters is more than one long, and known at compile time.
    class ASCIIMask {
     public:
      // Preset masks for some common character groups
      // When testing, you must check if the index is < 128 or use IsMasked()
      //
      // if (someChar < 128 && MaskCRLF()[someChar]) this is \r or \n

      static const ASCIIMaskArray& MaskCRLF();
      static const ASCIIMaskArray& Mask0to9();
      static const ASCIIMaskArray& MaskCRLFTab();
      static const ASCIIMaskArray& MaskWhitespace();

      static MOZ_ALWAYS_INLINE bool IsMasked(const ASCIIMaskArray& aMask,
                                             uint32_t aChar) {
        return aChar < 128 && aMask[aChar];
      }
    };

    // Outside of the preset ones, use these templates to create more masks.
    //
    // The example creation will look like this:
    //
    // constexpr bool TestABC(char c) { return c == 'A' || c == 'B' || c == 'C'; }
    // constexpr std::array sABCMask = CreateASCIIMask(TestABC);
    // ...
    // if (someChar < 128 && sABCMask[someChar]) this is A or B or C

    namespace details {
    template
    constexpr std::array CreateASCIIMask(
        F fun, std::index_sequence) {
      return {{fun(Indices)...}};
    }
    }  // namespace details

    template
    constexpr std::array CreateASCIIMask(F fun) {
      return details::CreateASCIIMask(fun, std::make_index_sequence<128>{});
    }

    }  // namespace mozilla

## Minimal test - lines (27, 43)

path: .spaces[0].spaces[0].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.5
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 66.60791492653966
new: 184.4773317567079
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.2916666666666667
new: 0.106951871657754
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 13.0
new: 21.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 35.161259458730164
new: 71.27302875388389
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.9534033032627869
new: 1.6969768750924736
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 6.0
new: 11.0
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 7.0
new: 10.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 18.0
new: 42.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.012453882740670712
new: 0.04794189077855202
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 3.4285714285714284
new: 9.35
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 228.36999403385028
new: 1724.8630519252192
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 8.0
new: 17.0
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 10.0
new: 25.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 12.68722189076946
new: 95.82572510695664
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 1.0
new: 17.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 1.0
new: 11.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 148.9361182512251
new: 97.2808055435992
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 87.09714517615504
new: 56.88935996701708
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 139.27036707768642
new: 99.0867925278072

### Code

    class ASCIIMask {
     public:
      // Preset masks for some common character groups
      // When testing, you must check if the index is < 128 or use IsMasked()
      //
      // if (someChar < 128 && MaskCRLF()[someChar]) this is \r or \n

      static const ASCIIMaskArray& MaskCRLF();
      static const ASCIIMaskArray& Mask0to9();
      static const ASCIIMaskArray& MaskCRLFTab();
      static const ASCIIMaskArray& MaskWhitespace();

      static MOZ_ALWAYS_INLINE bool IsMasked(const ASCIIMaskArray& aMask,
                                             uint32_t aChar) {
        return aChar < 128 && aMask[aChar];
      }
    };

## Minimal test - lines (54, 60)

path: .spaces[0].spaces[1].metrics.loc.sloc
old: 4.0
new: 7.0
path: .spaces[0].spaces[1].metrics.loc.ploc
old: 4.0
new: 7.0
path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 76.70975417931889
new: 66.05665920663085
path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 131.1736796466353
new: 112.95688724333876
path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 113.64458498874995
new: 87.46512878701483
path: .spaces[0].spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[0].spaces[1].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[0].spaces[1].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[0].spaces[1].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[0].spaces[1].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 16.36452797660028
new: 57.05865002596162
path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.4
new: 0.13333333333333333
path: .spaces[0].spaces[1].metrics.halstead.time
old: 3.75
new: 62.54887502163467
path: .spaces[0].spaces[1].metrics.halstead.effort
old: 67.5
new: 1125.879750389424
path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.81828088628892
new: 1.584962500721156
path: .spaces[0].spaces[1].metrics.halstead.n1
old: 5.0
new: 9.0
path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.005526047247960579
new: 0.0360750341363372
path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 2.5
new: 7.5
path: .spaces[0].spaces[1].metrics.halstead.n2
old: 3.0
new: 9.0
path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 8.0
new: 18.0
path: .spaces[0].spaces[1].metrics.halstead.length
old: 9.0
new: 36.0
path: .spaces[0].spaces[1].metrics.halstead.volume
old: 27.0
new: 150.11730005192322
path: .spaces[0].spaces[1].metrics.halstead.N1
old: 6.0
new: 21.0
path: .spaces[0].spaces[1].metrics.halstead.N2
old: 3.0
new: 15.0

### Code

    namespace details {
    template
    constexpr std::array CreateASCIIMask(
        F fun, std::index_sequence) {
      return {{fun(Indices)...}};
    }
    }  // namespace details

## Minimal test - lines (63, 65)

path: .spaces[0].spaces[2].metrics.mi.mi_sei
old: 63.32198561178021
new: 110.7222468482286
path: .spaces[0].spaces[2].metrics.mi.mi_original
old: 96.1515594730986
new: 129.14806920389006
path: .spaces[0].spaces[2].metrics.mi.mi_visual_studio
old: 56.22898214801087
new: 75.52518666894156
path: .spaces[0].spaces[2].metrics.halstead.length
old: 66.0
new: 25.0
path: .spaces[0].spaces[2].metrics.halstead.n1
old: 15.0
new: 9.0
path: .spaces[0].spaces[2].metrics.halstead.N2
old: 27.0
new: 9.0
path: .spaces[0].spaces[2].metrics.halstead.difficulty
old: 10.125
new: 6.75
path: .spaces[0].spaces[2].metrics.halstead.vocabulary
old: 35.0
new: 15.0
path: .spaces[0].spaces[2].metrics.halstead.estimated_program_length
old: 145.04192083187502
new: 44.039100017307746
path: .spaces[0].spaces[2].metrics.halstead.level
old: 0.09876543209876544
new: 0.14814814814814814
path: .spaces[0].spaces[2].metrics.halstead.time
old: 190.42463200408187
new: 36.62709933382987
path: .spaces[0].spaces[2].metrics.halstead.volume
old: 338.53267911836775
new: 97.67226489021296
path: .spaces[0].spaces[2].metrics.halstead.bugs
old: 0.07577788830693055
new: 0.025250041691176003
path: .spaces[0].spaces[2].metrics.halstead.N1
old: 39.0
new: 16.0
path: .spaces[0].spaces[2].metrics.halstead.effort
old: 3427.6433760734735
new: 659.2877880089376
path: .spaces[0].spaces[2].metrics.halstead.n2
old: 20.0
new: 6.0
path: .spaces[0].spaces[2].metrics.halstead.purity_ratio
old: 2.1976048610890153
new: 1.76156400069231
path: .spaces[0].spaces[2].metrics.cognitive.average
old: 2.0
new: 0.0
path: .spaces[0].spaces[2].metrics.cognitive.sum
old: 2.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[2].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[0].spaces[2].metrics.loc.blank
old: 1.0
new: 0.0
path: .spaces[0].spaces[2].metrics.loc.sloc
old: 15.0
new: 3.0
path: .spaces[0].spaces[2].metrics.loc.lloc
old: 6.0
new: 1.0
path: .spaces[0].spaces[2].metrics.loc.ploc
old: 14.0
new: 3.0
path: .spaces[0].spaces[2].metrics.cyclomatic.sum
old: 3.0
new: 1.0
path: .spaces[0].spaces[2].metrics.cyclomatic.average
old: 3.0
new: 1.0

### Code

    constexpr std::array CreateASCIIMask(F fun) {
      return details::CreateASCIIMask(fun, std::make_index_sequence<128>{});
    }