Global Metrics

path: .metrics.nom.functions
old: 9.0
new: 2.0

path: .metrics.nom.total
old: 9.0
new: 2.0

path: .metrics.cyclomatic.average
old: 1.6666666666666667
new: 1.0

path: .metrics.cyclomatic.sum
old: 20.0
new: 5.0

path: .metrics.loc.blank
old: 36.0
new: 10.0

path: .metrics.loc.cloc
old: 12.0
new: 26.0

path: .metrics.loc.sloc
old: 178.0
new: 54.0

path: .metrics.loc.ploc
old: 130.0
new: 18.0

path: .metrics.loc.lloc
old: 46.0
new: 0.0

path: .metrics.nexits.sum
old: 2.0
new: 0.0

path: .metrics.nexits.average
old: 0.2222222222222222
new: 0.0

path: .metrics.nargs.sum
old: 11.0
new: 1.0

path: .metrics.nargs.average
old: 1.2222222222222223
new: 0.5

path: .metrics.cognitive.average
old: 0.8888888888888888
new: 0.0

path: .metrics.cognitive.sum
old: 8.0
new: 0.0

path: .metrics.mi.mi_sei
old: 0.6360629546908214
new: 80.03807550914902

path: .metrics.mi.mi_visual_studio
old: 22.183323753154767
new: 45.09554309198852

path: .metrics.mi.mi_original
old: 37.93348361789465
new: 77.11337868730037

path: .metrics.halstead.purity_ratio
old: 0.9490719821306972
new: 1.9032649315378485

path: .metrics.halstead.N1
old: 411.0
new: 27.0

path: .metrics.halstead.effort
old: 211885.66393338356
new: 1838.967051150791

path: .metrics.halstead.difficulty
old: 40.526315789473685
new: 8.25

path: .metrics.halstead.N2
old: 350.0
new: 21.0

path: .metrics.halstead.bugs
old: 1.184712928035086
new: 0.050033556808185255

path: .metrics.halstead.length
old: 761.0
new: 48.0

path: .metrics.halstead.level
old: 0.024675324675324673
new: 0.12121212121212122

path: .metrics.halstead.time
old: 11771.425774076864
new: 102.16483617504394

path: .metrics.halstead.estimated_program_length
old: 722.2437784014606
new: 91.35671671381672

path: .metrics.halstead.vocabulary
old: 117.0
new: 25.0

path: .metrics.halstead.n1
old: 22.0
new: 11.0

path: .metrics.halstead.n2
old: 95.0
new: 14.0

path: .metrics.halstead.volume
old: 5228.347551602971
new: 222.9050971091868

Spaces Data

Minimal test - lines (15, 52)

path: .spaces[0].metrics.nexits.sum
old: 2.0
new: 0.0

path: .spaces[0].metrics.nexits.average
old: 0.2222222222222222
new: 0.0

path: .spaces[0].metrics.cognitive.average
old: 0.8888888888888888
new: 0.0

path: .spaces[0].metrics.cognitive.sum
old: 8.0
new: 0.0

path: .spaces[0].metrics.nargs.sum
old: 11.0
new: 1.0

path: .spaces[0].metrics.nargs.average
old: 1.2222222222222223
new: 0.5

path: .spaces[0].metrics.nom.functions
old: 9.0
new: 2.0

path: .spaces[0].metrics.nom.total
old: 9.0
new: 2.0

path: .spaces[0].metrics.halstead.length
old: 747.0
new: 43.0

path: .spaces[0].metrics.halstead.effort
old: 217981.97900542495
new: 1662.0529127794832

path: .spaces[0].metrics.halstead.volume
old: 5055.833690608364
new: 188.86964917948671

path: .spaces[0].metrics.halstead.estimated_program_length
old: 658.6435797488599
new: 71.27302875388389

path: .spaces[0].metrics.halstead.level
old: 0.023193814982671288
new: 0.11363636363636365

path: .spaces[0].metrics.halstead.bugs
old: 1.2073294824101672
new: 0.04677085499804086

path: .spaces[0].metrics.halstead.N1
old: 406.0
new: 27.0

path: .spaces[0].metrics.halstead.n2
old: 87.0
new: 10.0

path: .spaces[0].metrics.halstead.vocabulary
old: 109.0
new: 21.0

path: .spaces[0].metrics.halstead.n1
old: 22.0
new: 11.0

path: .spaces[0].metrics.halstead.time
old: 12110.109944745833
new: 92.33627293219352

path: .spaces[0].metrics.halstead.N2
old: 341.0
new: 16.0

path: .spaces[0].metrics.halstead.purity_ratio
old: 0.8817183129168138
new: 1.6575122966019509

path: .spaces[0].metrics.halstead.difficulty
old: 43.11494252873563
new: 8.8

path: .spaces[0].metrics.loc.lloc
old: 46.0
new: 0.0

path: .spaces[0].metrics.loc.sloc
old: 158.0
new: 38.0

path: .spaces[0].metrics.loc.blank
old: 31.0
new: 7.0

path: .spaces[0].metrics.loc.cloc
old: 6.0
new: 19.0

path: .spaces[0].metrics.loc.ploc
old: 121.0
new: 12.0

path: .spaces[0].metrics.mi.mi_original
old: 40.268810647529065
new: 83.89760734320944

path: .spaces[0].metrics.mi.mi_sei
old: -0.8042661382827294
new: 90.20169170846708

path: .spaces[0].metrics.mi.mi_visual_studio
old: 23.549012074578403
new: 49.062928270882715

path: .spaces[0].metrics.cyclomatic.average
old: 1.7272727272727273
new: 1.0

path: .spaces[0].metrics.cyclomatic.sum
old: 19.0
new: 4.0

Code

namespace mozilla {

/**
 * A deterministic acyclic finite state automaton suitable for storing static
 * dictionaries of tagged ascii strings. Consider using this if you have a very
 * large set of strings that need an associated enum value.
 *
 * Currently the string tag is limited by `make_dafsa.py` to a value of [0-4].
 * In theory [0-15] can easily be supported.
 *
 * See `make_dafsa.py` for more details.
 */
class Dafsa {
 public:
  using Graph = Span;

  /**
   * Initializes the DAFSA with a binary encoding generated by `make_dafsa.py`.
   */
  explicit Dafsa(const Graph& aData) : mData(aData) {}

  ~Dafsa() = default;

  /**
   * Searches for the given string in the DAFSA.
   *
   * @param aKey The string to search for.
   * @returns kKeyNotFound if not found, otherwise the associated tag.
   */
  int Lookup(const nsACString& aKey) const;

  static const int kKeyNotFound;

 private:
  const Graph mData;
};

}  // namespace mozilla

Minimal test - lines (27, 50)

path: .spaces[0].spaces[0].metrics.nom.functions
old: 1.0
new: 2.0

path: .spaces[0].spaces[0].metrics.nom.total
old: 1.0
new: 2.0

path: .spaces[0].spaces[0].metrics.halstead.N1
old: 68.0
new: 25.0

path: .spaces[0].spaces[0].metrics.halstead.volume
old: 727.9628520751327
new: 172.8771237954945

path: .spaces[0].spaces[0].metrics.halstead.n1
old: 13.0
new: 11.0

path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 15.017241379310343
new: 9.166666666666666

path: .spaces[0].spaces[0].metrics.halstead.n2
old: 29.0
new: 9.0

path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.3999049273669166
new: 1.664576820449777

path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.06659012629161883
new: 0.1090909090909091

path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 42.0
new: 20.0

path: .spaces[0].spaces[0].metrics.halstead.effort
old: 10931.99386478346
new: 1584.706968125366

path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.1641893555110124
new: 0.04530833020757158

path: .spaces[0].spaces[0].metrics.halstead.length
old: 135.0
new: 40.0

path: .spaces[0].spaces[0].metrics.halstead.time
old: 607.3329924879699
new: 88.03927600696478

path: .spaces[0].spaces[0].metrics.halstead.N2
old: 67.0
new: 15.0

path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 188.98716519453376
new: 66.58307281799108

path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 46.82345817710113
new: 98.0113158636246

path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 84.78622784683108
new: 92.03210635804842

path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 49.58258938411174
new: 53.81994523862481

path: .spaces[0].spaces[0].metrics.nargs.average
old: 2.0
new: 0.5

path: .spaces[0].spaces[0].metrics.nargs.sum
old: 2.0
new: 1.0

path: .spaces[0].spaces[0].metrics.loc.ploc
old: 19.0
new: 10.0

path: .spaces[0].spaces[0].metrics.loc.lloc
old: 10.0
new: 0.0

path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 9.0

path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 1.0
new: 0.0

path: .spaces[0].spaces[0].metrics.cognitive.average
old: 1.0
new: 0.0

path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 2.0
new: 1.0

path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 3.0

Code

class Dafsa {
 public:
  using Graph = Span;

  /**
   * Initializes the DAFSA with a binary encoding generated by `make_dafsa.py`.
   */
  explicit Dafsa(const Graph& aData) : mData(aData) {}

  ~Dafsa() = default;

  /**
   * Searches for the given string in the DAFSA.
   *
   * @param aKey The string to search for.
   * @returns kKeyNotFound if not found, otherwise the associated tag.
   */
  int Lookup(const nsACString& aKey) const;

  static const int kKeyNotFound;

 private:
  const Graph mData;
};