# Global Metrics

path: .metrics.loc.blank
old: 23.0
new: 31.0
path: .metrics.loc.sloc
old: 460.0
new: 232.0
path: .metrics.loc.ploc
old: 226.0
new: 94.0
path: .metrics.loc.cloc
old: 211.0
new: 107.0
path: .metrics.loc.lloc
old: 107.0
new: 10.0
path: .metrics.nexits.average
old: 0.625
new: 0.25
path: .metrics.nexits.sum
old: 5.0
new: 3.0
path: .metrics.cognitive.average
old: 5.375
new: 0.3333333333333333
path: .metrics.cognitive.sum
old: 43.0
new: 4.0
path: .metrics.halstead.vocabulary
old: 123.0
new: 66.0
path: .metrics.halstead.estimated_program_length
old: 752.2093122580814
new: 343.1368500605771
path: .metrics.halstead.n1
old: 32.0
new: 18.0
path: .metrics.halstead.purity_ratio
old: 0.5522829018047587
new: 1.075664106772969
path: .metrics.halstead.time
old: 57727.1352641761
new: 2450.37219101242
path: .metrics.halstead.N1
old: 737.0
new: 197.0
path: .metrics.halstead.difficulty
old: 109.89010989010988
new: 22.875
path: .metrics.halstead.volume
old: 9455.704756272044
new: 1928.161724075347
path: .metrics.halstead.length
old: 1362.0
new: 319.0
path: .metrics.halstead.level
old: 0.0091
new: 0.04371584699453552
path: .metrics.halstead.bugs
old: 3.419640243204413
new: 0.416116674185234
path: .metrics.halstead.n2
old: 91.0
new: 48.0
path: .metrics.halstead.N2
old: 625.0
new: 122.0
path: .metrics.halstead.effort
old: 1039088.4347551698
new: 44106.69943822356
path: .metrics.cyclomatic.sum
old: 39.0
new: 28.0
path: .metrics.cyclomatic.average
old: 3.9
new: 1.2173913043478262
path: .metrics.mi.mi_sei
old: -6.5913536446879135
new: 23.93615427015211
path: .metrics.mi.mi_original
old: 15.101388585821311
new: 36.98837834114675
path: .metrics.mi.mi_visual_studio
old: 8.831221395217142
new: 21.63063060885775
path: .metrics.nom.functions
old: 8.0
new: 12.0
path: .metrics.nom.total
old: 8.0
new: 12.0
path: .metrics.nargs.average
old: 2.375
new: 0.3333333333333333
path: .metrics.nargs.sum
old: 19.0
new: 4.0

# Spaces Data

## Minimal test - lines (18, 20)

path: .spaces[0].metrics.loc.sloc
old: 35.0
new: 3.0
path: .spaces[0].metrics.loc.lloc
old: 9.0
new: 0.0
path: .spaces[0].metrics.loc.cloc
old: 11.0
new: 0.0
path: .spaces[0].metrics.loc.ploc
old: 24.0
new: 3.0
path: .spaces[0].metrics.nexits.average
old: 0.0
new: null
path: .spaces[0].metrics.cyclomatic.average
old: 2.0
new: 1.0
path: .spaces[0].metrics.mi.mi_sei
old: 73.67242810595283
new: 129.26360748831726
path: .spaces[0].metrics.mi.mi_visual_studio
old: 44.99446156214899
new: 82.99964029639851
path: .spaces[0].metrics.mi.mi_original
old: 76.94052927127477
new: 141.92938490684145
path: .spaces[0].metrics.halstead.N2
old: 85.0
new: 2.0
path: .spaces[0].metrics.halstead.difficulty
old: 23.448275862068964
new: 1.0
path: .spaces[0].metrics.halstead.N1
old: 100.0
new: 2.0
path: .spaces[0].metrics.halstead.volume
old: 1015.99282282099
new: 8.0
path: .spaces[0].metrics.halstead.n2
old: 29.0
new: 2.0
path: .spaces[0].metrics.halstead.vocabulary
old: 45.0
new: 4.0
path: .spaces[0].metrics.halstead.n1
old: 16.0
new: 2.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.1074672911281058
new: 1.0
path: .spaces[0].metrics.halstead.length
old: 185.0
new: 4.0
path: .spaces[0].metrics.halstead.level
old: 0.04264705882352941
new: 1.0
path: .spaces[0].metrics.halstead.bugs
old: 0.2759813799323924
new: 0.0013333333333333333
path: .spaces[0].metrics.halstead.estimated_program_length
old: 204.88144885869957
new: 4.0
path: .spaces[0].metrics.halstead.effort
old: 23823.27998338873
new: 8.0
path: .spaces[0].metrics.halstead.time
old: 1323.5155546327069
new: 0.4444444444444444
path: .spaces[0].metrics.nargs.average
old: 1.0
new: null
path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[0].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: 1.0
new: null
path: .spaces[0].metrics.cognitive.sum
old: 1.0
new: 0.0

### Code

    namespace sandbox {
    class BrokerServices;
    }

## Minimal test - lines (21, 25)

path: .spaces[1].metrics.mi.mi_original
old: 73.50766700801942
new: 130.53948741585606
path: .spaces[1].metrics.mi.mi_sei
old: 70.53167367865566
new: 112.93327872124344
path: .spaces[1].metrics.mi.mi_visual_studio
old: 42.98693977077159
new: 76.33888152974038
path: .spaces[1].metrics.halstead.N2
old: 98.0
new: 3.0
path: .spaces[1].metrics.halstead.bugs
old: 0.3367360218258065
new: 0.0019299471801733172
path: .spaces[1].metrics.halstead.difficulty
old: 28.26923076923077
new: 1.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 180.8147916057962
new: 6.754887502163468
path: .spaces[1].metrics.halstead.n1
old: 15.0
new: 2.0
path: .spaces[1].metrics.halstead.effort
old: 32108.22128306115
new: 13.931568569324174
path: .spaces[1].metrics.halstead.time
old: 1783.790071281175
new: 0.7739760316291208
path: .spaces[1].metrics.halstead.purity_ratio
old: 0.852899960404699
new: 1.1258145836939113
path: .spaces[1].metrics.halstead.n2
old: 26.0
new: 3.0
path: .spaces[1].metrics.halstead.N1
old: 114.0
new: 3.0
path: .spaces[1].metrics.halstead.length
old: 212.0
new: 6.0
path: .spaces[1].metrics.halstead.vocabulary
old: 41.0
new: 5.0
path: .spaces[1].metrics.halstead.volume
old: 1135.801024979034
new: 13.931568569324174
path: .spaces[1].metrics.halstead.level
old: 0.03537414965986394
new: 1.0
path: .spaces[1].metrics.nargs.average
old: 1.0
new: null
path: .spaces[1].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[1].metrics.loc.sloc
old: 40.0
new: 5.0
path: .spaces[1].metrics.loc.lloc
old: 12.0
new: 0.0
path: .spaces[1].metrics.loc.ploc
old: 26.0
new: 5.0
path: .spaces[1].metrics.loc.cloc
old: 14.0
new: 0.0
path: .spaces[1].metrics.cyclomatic.average
old: 5.0
new: 1.0
path: .spaces[1].metrics.cyclomatic.sum
old: 5.0
new: 3.0
path: .spaces[1].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[1].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[1].metrics.nexits.average
old: 0.0
new: null
path: .spaces[1].metrics.cognitive.average
old: 7.0
new: null
path: .spaces[1].metrics.cognitive.sum
old: 7.0
new: 0.0

### Code

    namespace mozilla {
    namespace sandboxing {
    class PermissionsService;
    }
    }  // namespace mozilla

## Minimal test - lines (28, 230)

path: .spaces[2].metrics.cyclomatic.average
old: 5.0
new: 1.2352941176470589
path: .spaces[2].metrics.cyclomatic.sum
old: 5.0
new: 21.0
path: .spaces[2].metrics.cognitive.average
old: 7.0
new: 0.25
path: .spaces[2].metrics.cognitive.sum
old: 7.0
new: 3.0
path: .spaces[2].metrics.mi.mi_sei
old: 76.47088196435759
new: 30.156889950579213
path: .spaces[2].metrics.mi.mi_original
old: 77.54356205619854
new: 41.29606999621721
path: .spaces[2].metrics.mi.mi_visual_studio
old: 45.34711231356639
new: 24.14974853579954
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 0.25
path: .spaces[2].metrics.loc.cloc
old: 12.0
new: 99.0
path: .spaces[2].metrics.loc.sloc
old: 34.0
new: 203.0
path: .spaces[2].metrics.loc.lloc
old: 11.0
new: 10.0
path: .spaces[2].metrics.loc.blank
old: 1.0
new: 29.0
path: .spaces[2].metrics.loc.ploc
old: 21.0
new: 75.0
path: .spaces[2].metrics.halstead.N1
old: 85.0
new: 189.0
path: .spaces[2].metrics.halstead.difficulty
old: 23.142857142857142
new: 24.3
path: .spaces[2].metrics.halstead.level
old: 0.043209876543209874
new: 0.0411522633744856
path: .spaces[2].metrics.halstead.estimated_program_length
old: 209.6645878435745
new: 287.9357738214561
path: .spaces[2].metrics.halstead.vocabulary
old: 46.0
new: 58.0
path: .spaces[2].metrics.halstead.time
old: 1114.97043484408
new: 2348.7574799964004
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.3354432346724492
new: 0.9694807199375628
path: .spaces[2].metrics.halstead.N2
old: 72.0
new: 108.0
path: .spaces[2].metrics.halstead.n2
old: 28.0
new: 40.0
path: .spaces[2].metrics.halstead.length
old: 157.0
new: 297.0
path: .spaces[2].metrics.halstead.bugs
old: 0.2461704859962159
new: 0.4045316750840616
path: .spaces[2].metrics.halstead.volume
old: 867.199227100951
new: 1739.820355552889
path: .spaces[2].metrics.halstead.effort
old: 20069.46782719344
new: 42277.6346399352
path: .spaces[2].metrics.nom.functions
old: 1.0
new: 12.0
path: .spaces[2].metrics.nom.total
old: 1.0
new: 12.0
path: .spaces[2].metrics.nargs.average
old: 1.0
new: 0.3333333333333333
path: .spaces[2].metrics.nargs.sum
old: 1.0
new: 4.0

### Code

    namespace mozilla {

    struct StaticXREAppData;

    /**
     * Application-specific data needed to start the apprunner.
     */
    class XREAppData {
     public:
      XREAppData() = default;
      ~XREAppData() = default;
      XREAppData(const XREAppData& aOther) { *this = aOther; }

      explicit XREAppData(const StaticXREAppData& aOther) { *this = aOther; }

      XREAppData& operator=(const StaticXREAppData& aOther);
      XREAppData& operator=(const XREAppData& aOther);
      XREAppData& operator=(XREAppData&& aOther) = default;

      // Lots of code reads these fields directly like a struct, so rather
      // than using UniquePtr directly, use an auto-converting wrapper.
      class CharPtr {
       public:
        explicit CharPtr() = default;
        explicit CharPtr(const char* v) { *this = v; }
        CharPtr(CharPtr&&) = default;
        ~CharPtr() = default;

        CharPtr& operator=(const char* v) {
          if (v) {
            mValue.reset(NS_xstrdup(v));
          } else {
            mValue = nullptr;
          }
          return *this;
        }
        CharPtr& operator=(const CharPtr& v) {
          *this = (const char*)v;
          return *this;
        }

        operator const char*() const { return mValue.get(); }

       private:
        UniqueFreePtr mValue;
      };

      /**
       * The directory of the application to be run. May be null if the
       * xulrunner and the app are installed into the same directory.
       */
      nsCOMPtr directory;

      /**
       * The name of the application vendor. This must be ASCII, and is normally
       * mixed-case, e.g. "Mozilla". Optional (may be null), but highly
       * recommended. Must not be the empty string.
       */
      CharPtr vendor;

      /**
       * The name of the application. This must be ASCII, and is normally
       * mixed-case, e.g. "Firefox". Required (must not be null or an empty
       * string).
       */
      CharPtr name;

      /**
       * The internal name of the application for remoting purposes. When left
       * unspecified, "name" is used instead. This must be ASCII, and is normally
       * lowercase, e.g. "firefox". Optional (may be null but not an empty string).
       */
      CharPtr remotingName;

      /**
       * The major version, e.g. "0.8.0+". Optional (may be null), but
       * required for advanced application features such as the extension
       * manager and update service. Must not be the empty string.
       */
      CharPtr version;

      /**
       * The application's build identifier, e.g. "2004051604"
       */
      CharPtr buildID;

      /**
       * The application's UUID. Used by the extension manager to determine
       * compatible extensions. Optional, but required for advanced application
       * features such as the extension manager and update service.
       *
       * This has traditionally been in the form
       * "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" but for new applications
       * a more readable form is encouraged: "appname@vendor.tld". Only
       * the following characters are allowed: a-z A-Z 0-9 - . @ _ { } *
       */
      CharPtr ID;

      /**
       * The copyright information to print for the -h commandline flag,
       * e.g. "Copyright (c) 2003 mozilla.org".
       */
      CharPtr copyright;

      /**
       * Combination of NS_XRE_ prefixed flags (defined below).
       */
      uint32_t flags = 0;

      /**
       * The location of the XRE. XRE_main may not be able to figure this out
       * programatically.
       */
      nsCOMPtr xreDirectory;

      /**
       * The minimum/maximum compatible XRE version.
       */
      CharPtr minVersion;
      CharPtr maxVersion;

      /**
       * The server URL to send crash reports to.
       */
      CharPtr crashReporterURL;

      /**
       * The profile directory that will be used. Optional (may be null). Must not
       * be the empty string, must be ASCII. The path is split into components
       * along the path separator characters '/' and '\'.
       *
       * The application data directory ("UAppData", see below) is normally
       * composed as follows, where $HOME is platform-specific:
       *
       *   UAppData = $HOME[/$vendor]/$name
       *
       * If present, the 'profile' string will be used instead of the combination of
       * vendor and name as follows:
       *
       *   UAppData = $HOME/$profile
       */
      CharPtr profile;

      /**
       * The application name to use in the User Agent string.
       */
      CharPtr UAName;

      /**
       * The URL to the source revision for this build of the application.
       */
      CharPtr sourceURL;

      /**
       * The URL to use to check for updates.
       */
      CharPtr updateURL;

    #if defined(XP_WIN) && defined(MOZ_SANDBOX)
      /**
       * Chromium sandbox BrokerServices.
       */
      sandbox::BrokerServices* sandboxBrokerServices = nullptr;
      mozilla::sandboxing::PermissionsService* sandboxPermissionsService;
    #endif
    };

    /**
     * Indicates whether or not the profile migrator service may be
     * invoked at startup when creating a profile.
     */
    #define NS_XRE_ENABLE_PROFILE_MIGRATOR (1 << 1)

    /**
     * Indicates whether or not to use Breakpad crash reporting.
     */
    #define NS_XRE_ENABLE_CRASH_REPORTER (1 << 3)

    /**
     * A static version of the XRE app data is compiled into the application
     * so that it is not necessary to read application.ini at startup.
     *
     * This structure is initialized into and matches nsXREAppData
     */
    struct StaticXREAppData {
      const char* vendor;
      const char* name;
      const char* remotingName;
      const char* version;
      const char* buildID;
      const char* ID;
      const char* copyright;
      uint32_t flags;
      const char* minVersion;
      const char* maxVersion;
      const char* crashReporterURL;
      const char* profile;
      const char* UAName;
      const char* sourceURL;
      const char* updateURL;
    };

    }  // namespace mozilla