# Global Metrics

path: .metrics.nargs.average
old: 6.943396226415095
new: 1.5
path: .metrics.nargs.sum
old: 368.0
new: 3.0
path: .metrics.nom.functions
old: 53.0
new: 2.0
path: .metrics.nom.total
old: 53.0
new: 2.0
path: .metrics.halstead.n1
old: 51.0
new: 13.0
path: .metrics.halstead.vocabulary
old: 1106.0
new: 80.0
path: .metrics.halstead.level
old: 0.00325204755695707
new: 0.10307692307692308
path: .metrics.halstead.difficulty
old: 307.49857819905213
new: 9.701492537313433
path: .metrics.halstead.effort
old: 89462965.31024995
new: 14290.388208517776
path: .metrics.halstead.n2
old: 1055.0
new: 67.0
path: .metrics.halstead.N1
old: 16052.0
new: 133.0
path: .metrics.halstead.bugs
old: 66.67672670992039
new: 0.19629448431909705
path: .metrics.halstead.purity_ratio
old: 0.378282042004337
new: 1.9507883780965876
path: .metrics.halstead.N2
old: 12722.0
new: 100.0
path: .metrics.halstead.volume
old: 290937.8177753335
new: 1473.0092461087554
path: .metrics.halstead.time
old: 4970164.739458331
new: 793.9104560287653
path: .metrics.halstead.estimated_program_length
old: 10884.687476632793
new: 454.5336920965049
path: .metrics.halstead.length
old: 28774.0
new: 233.0
path: .metrics.loc.blank
old: 519.0
new: 34.0
path: .metrics.loc.ploc
old: 3864.0
new: 64.0
path: .metrics.loc.sloc
old: 4760.0
new: 227.0
path: .metrics.loc.cloc
old: 377.0
new: 129.0
path: .metrics.loc.lloc
old: 1899.0
new: 0.0
path: .metrics.cognitive.sum
old: 1744.0
new: 0.0
path: .metrics.cognitive.average
old: 32.905660377358494
new: 0.0
path: .metrics.cyclomatic.average
old: 8.452173913043477
new: 1.0
path: .metrics.cyclomatic.sum
old: 972.0
new: 7.0
path: .metrics.mi.mi_sei
old: -323.7378786697215
new: 33.86775813638483
path: .metrics.mi.mi_visual_studio
old: 0.0
new: 25.48039983075335
path: .metrics.mi.mi_original
old: -255.1621449062872
new: 43.571483710588225
path: .metrics.nexits.average
old: 1.4150943396226414
new: 0.0
path: .metrics.nexits.sum
old: 75.0
new: 0.0

# Spaces Data

## Minimal test - lines (42, 112)

path: .spaces[2].metrics.loc.ploc
old: 16.0
new: 18.0
path: .spaces[2].metrics.loc.sloc
old: 16.0
new: 71.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 42.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 11.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 103.8483063527908
new: 137.26120593818493
path: .spaces[2].metrics.halstead.time
old: 37.18072687101022
new: 114.2908619313582
path: .spaces[2].metrics.halstead.n2
old: 21.0
new: 23.0
path: .spaces[2].metrics.halstead.volume
old: 244.4228653433368
new: 337.9744059970164
path: .spaces[2].metrics.halstead.length
old: 52.0
new: 67.0
path: .spaces[2].metrics.halstead.level
old: 0.3652173913043478
new: 0.16428571428571428
path: .spaces[2].metrics.halstead.n1
old: 5.0
new: 10.0
path: .spaces[2].metrics.halstead.vocabulary
old: 26.0
new: 33.0
path: .spaces[2].metrics.halstead.bugs
old: 0.025503845329566205
new: 0.05391812162115984
path: .spaces[2].metrics.halstead.N1
old: 29.0
new: 39.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.9970828144767456
new: 2.0486747154952973
path: .spaces[2].metrics.halstead.effort
old: 669.253083678184
new: 2057.2355147644475
path: .spaces[2].metrics.halstead.N2
old: 23.0
new: 28.0
path: .spaces[2].metrics.halstead.difficulty
old: 2.738095238095238
new: 6.086956521739131
path: .spaces[2].metrics.mi.mi_sei
old: 64.48717569685859
new: 73.9067201292841
path: .spaces[2].metrics.mi.mi_original
old: 97.02978384385828
new: 71.4351411042197
path: .spaces[2].metrics.mi.mi_visual_studio
old: 56.74256365137911
new: 41.77493631825713
path: .spaces[2].metrics.cyclomatic.sum
old: 2.0
new: 1.0

### Code

    class nsUserIdleServiceDaily : public nsIObserver,
                                   public nsSupportsWeakReference {
     public:
      NS_DECL_ISUPPORTS
      NS_DECL_NSIOBSERVER

      explicit nsUserIdleServiceDaily(nsIUserIdleService* aIdleService);

      /**
       * Initializes the daily idle observer.
       * Keep this separated from the constructor, since it could cause pointer
       * corruption due to AddRef/Release of "this".
       */
      void Init();

     private:
      virtual ~nsUserIdleServiceDaily();

      /**
       * StageIdleDaily is the interim call made when an idle-daily event is due.
       * However we don't want to fire idle-daily until the user is idle for this
       * session, so this sets up a short wait for an idle event which triggers
       * the actual idle-daily event.
       *
       * @param aHasBeenLongWait Pass true indicating nsUserIdleServiceDaily is
       * having trouble getting the idle-daily event fired. If true StageIdleDaily
       * will use a shorter idle wait time before firing idle-daily.
       */
      void StageIdleDaily(bool aHasBeenLongWait);

      /**
       * @note This is a normal pointer, part to avoid creating a cycle with the
       * idle service, part to avoid potential pointer corruption due to this class
       * being instantiated in the constructor of the service itself.
       */
      nsIUserIdleService* mIdleService;

      /**
       * Place to hold the timer used by this class to determine when a day has
       * passed, after that it will wait for idle time to be detected.
       */
      nsCOMPtr mTimer;

      /**
       * Function that is called back once a day.
       */
      static void DailyCallback(nsITimer* aTimer, void* aClosure);

      /**
       * Cache of observers for the "idle-daily" category.
       */
      nsCategoryCache mCategoryObservers;

      /**
       * Boolean set to true when daily idle notifications should be disabled.
       */
      bool mShutdownInProgress;

      /**
       * Next time we expect an idle-daily timer to fire, in case timers aren't
       * very reliable on the platform. Value is in PR_Now microsecond units.
       */
      PRTime mExpectedTriggerTime;

      /**
       * Tracks which idle daily observer callback we ask for. There are two: a
       * regular long idle wait and a shorter wait if we've been waiting to fire
       * idle daily for an extended period. Set by StageIdleDaily.
       */
      int32_t mIdleDailyTriggerWait;
    };

## Minimal test - lines (114, 225)

path: .spaces[3].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[3].metrics.cognitive.average
old: 1.0
new: null
path: .spaces[3].metrics.cyclomatic.sum
old: 4.0
new: 1.0
path: .spaces[3].metrics.cyclomatic.average
old: 1.3333333333333333
new: 1.0
path: .spaces[3].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[3].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[3].metrics.nargs.sum
old: 6.0
new: 0.0
path: .spaces[3].metrics.nargs.average
old: 6.0
new: null
path: .spaces[3].metrics.loc.blank
old: 4.0
new: 16.0
path: .spaces[3].metrics.loc.cloc
old: 0.0
new: 72.0
path: .spaces[3].metrics.loc.lloc
old: 13.0
new: 0.0
path: .spaces[3].metrics.loc.ploc
old: 20.0
new: 24.0
path: .spaces[3].metrics.loc.sloc
old: 24.0
new: 112.0
path: .spaces[3].metrics.halstead.volume
old: 1170.2878354979196
new: 572.1226517227967
path: .spaces[3].metrics.halstead.bugs
old: 0.3646439241194646
new: 0.08429132532508987
path: .spaces[3].metrics.halstead.effort
old: 36181.39891414402
new: 4021.204923537371
path: .spaces[3].metrics.halstead.N2
old: 106.0
new: 41.0
path: .spaces[3].metrics.halstead.time
old: 2010.0777174524455
new: 223.40027352985396
path: .spaces[3].metrics.halstead.level
old: 0.03234501347708895
new: 0.14227642276422764
path: .spaces[3].metrics.halstead.length
old: 223.0
new: 103.0
path: .spaces[3].metrics.halstead.difficulty
old: 30.916666666666668
new: 7.0285714285714285
path: .spaces[3].metrics.halstead.estimated_program_length
old: 163.3420689261142
new: 222.5444556017277
path: .spaces[3].metrics.halstead.n1
old: 14.0
new: 12.0
path: .spaces[3].metrics.halstead.vocabulary
old: 38.0
new: 47.0
path: .spaces[3].metrics.halstead.N1
old: 117.0
new: 62.0
path: .spaces[3].metrics.halstead.n2
old: 24.0
new: 35.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 0.7324756454085838
new: 2.1606257825410458
path: .spaces[3].metrics.nexits.average
old: 0.0
new: null
path: .spaces[3].metrics.mi.mi_visual_studio
old: 47.8698841475433
new: 35.85595358696485
path: .spaces[3].metrics.mi.mi_original
old: 81.85750189229904
new: 61.31368063370989
path: .spaces[3].metrics.mi.mi_sei
old: 42.801839485183834
new: 60.18140077174998

### Code

    class nsUserIdleService : public nsIUserIdleServiceInternal {
     public:
      NS_DECL_ISUPPORTS
      NS_DECL_NSIUSERIDLESERVICE NS_DECL_NSIUSERIDLESERVICEINTERNAL

          protected : static already_AddRefed
                      GetInstance();

      nsUserIdleService();
      virtual ~nsUserIdleService();

      /**
       * If there is a platform specific function to poll the system idel time
       * then that must be returned in this function, and the function MUST return
       * true, otherwise then the function should be left unimplemented or made
       * to return false (this can also be used for systems where it depends on
       * the configuration of the system if the idle time can be determined)
       *
       * @param aIdleTime
       *        The idle time in ms.
       *
       * @return true if the idle time could be polled, false otherwise.
       *
       * @note The time returned by this function can be different than the one
       *       returned by GetIdleTime, as that is corrected by any calls to
       *       ResetIdleTimeOut(), unless you overwrite that function too...
       */
      virtual bool PollIdleTime(uint32_t* aIdleTime);

      /**
       * Function that determines if we are in poll mode or not.
       *
       * @return true if polling is supported, false otherwise.
       */
      virtual bool UsePollMode();

     private:
      /**
       * Ensure that the timer is expiring at least at the given time
       *
       * The function might not restart the timer if there is one running currently
       *
       * @param aNextTimeout
       *        The last absolute time the timer should expire
       */
      void SetTimerExpiryIfBefore(mozilla::TimeStamp aNextTimeout);

      /**
       * Stores the next timeout time, 0 means timer not running
       */
      mozilla::TimeStamp mCurrentlySetToTimeoutAt;

      /**
       * mTimer holds the internal timer used by this class to detect when to poll
       * for idle time, when to check if idle timers should expire etc.
       */
      nsCOMPtr mTimer;

      /**
       * Array of listeners that wants to be notified about idle time.
       */
      nsTArray mArrayListeners;

      /**
       * Object keeping track of the daily idle thingy.
       */
      RefPtr mDailyIdle;

      /**
       * Number of observers currently in idle mode.
       */
      uint32_t mIdleObserverCount;

      /**
       * Delta time from last non idle time to when the next observer should switch
       * to idle mode
       *
       * Time in seconds
       *
       * If this value is 0 it means there are no active observers
       */
      uint32_t mDeltaToNextIdleSwitchInS;

      /**
       * If true, the idle service is temporarily disabled, and all idle events
       * will be ignored.
       */
      bool mDisabled = false;

      /**
       * Absolute value for when the last user interaction took place.
       */
      mozilla::TimeStamp mLastUserInteraction;

      /**
       * Function that ensures the timer is running with at least the minimum time
       * needed.  It will kill the timer if there are no active observers.
       */
      void ReconfigureTimer(void);

      /**
       * Callback function that is called when the internal timer expires.
       *
       * This in turn calls the IdleTimerCallback that does the real processing
       */
      static void StaticIdleTimerCallback(nsITimer* aTimer, void* aClosure);

      /**
       * Function that handles when a timer has expired
       */
      void IdleTimerCallback(void);
    };

## Minimal test - lines (25, 34)

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.mi.mi_sei
old: 113.64458498874995
new: 76.39523165721535
path: .spaces[0].metrics.mi.mi_original
old: 131.1736796466353
new: 105.2132431102584
path: .spaces[0].metrics.mi.mi_visual_studio
old: 76.70975417931889
new: 61.52821234518036
path: .spaces[0].metrics.nexits.average
old: null
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[0].metrics.loc.sloc
old: 4.0
new: 10.0
path: .spaces[0].metrics.loc.ploc
old: 4.0
new: 9.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[0].metrics.halstead.N2
old: 5.0
new: 19.0
path: .spaces[0].metrics.halstead.volume
old: 27.0
new: 209.59328607595296
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.81828088628892
new: 1.6221027863303723
path: .spaces[0].metrics.halstead.bugs
old: 0.0039311120913133445
new: 0.059575389533385946
path: .spaces[0].metrics.halstead.estimated_program_length
old: 16.36452797660028
new: 76.2388309575275
path: .spaces[0].metrics.halstead.time
old: 2.25
new: 132.74241451477022
path: .spaces[0].metrics.halstead.vocabulary
old: 8.0
new: 22.0
path: .spaces[0].metrics.halstead.level
old: 0.6666666666666666
new: 0.08771929824561403
path: .spaces[0].metrics.halstead.n1
old: 3.0
new: 12.0
path: .spaces[0].metrics.halstead.effort
old: 40.5
new: 2389.363461265864
path: .spaces[0].metrics.halstead.length
old: 9.0
new: 47.0
path: .spaces[0].metrics.halstead.N1
old: 4.0
new: 28.0
path: .spaces[0].metrics.halstead.n2
old: 5.0
new: 10.0
path: .spaces[0].metrics.halstead.difficulty
old: 1.5
new: 11.4
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[0].metrics.nargs.average
old: null
new: 1.5

### Code

    class IdleListener {
     public:
      nsCOMPtr observer;
      uint32_t reqIdleTime;
      bool isIdle;

      IdleListener(nsIObserver* obs, uint32_t reqIT, bool aIsIdle = false)
          : observer(obs), reqIdleTime(reqIT), isIdle(aIsIdle) {}
      ~IdleListener() = default;
    };

## Minimal test - lines (37, 37)

path: .spaces[1].metrics.mi.mi_visual_studio
old: 81.12095583420833
new: null
path: .spaces[1].metrics.mi.mi_original
old: 138.71683447649625
new: null
path: .spaces[1].metrics.mi.mi_sei
old: 124.52705705444804
new: null
path: .spaces[1].metrics.loc.sloc
old: 3.0
new: 1.0
path: .spaces[1].metrics.loc.ploc
old: 3.0
new: 1.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.584962500721156
new: null
path: .spaces[1].metrics.halstead.estimated_program_length
old: 9.509775004326936
new: null
path: .spaces[1].metrics.halstead.n2
old: 3.0
new: 1.0
path: .spaces[1].metrics.halstead.length
old: 6.0
new: 1.0
path: .spaces[1].metrics.halstead.n1
old: 3.0
new: 0.0
path: .spaces[1].metrics.halstead.bugs
old: 0.0027165012951989257
new: 0.0
path: .spaces[1].metrics.halstead.N1
old: 3.0
new: 0.0
path: .spaces[1].metrics.halstead.difficulty
old: 1.5
new: 0.0
path: .spaces[1].metrics.halstead.effort
old: 23.264662506490403
new: 0.0
path: .spaces[1].metrics.halstead.time
old: 1.292481250360578
new: 0.0
path: .spaces[1].metrics.halstead.vocabulary
old: 6.0
new: 1.0
path: .spaces[1].metrics.halstead.volume
old: 15.509775004326936
new: 0.0
path: .spaces[1].metrics.halstead.N2
old: 3.0
new: 1.0
path: .spaces[1].metrics.halstead.level
old: 0.6666666666666666
new: null

### Code

    class nsUserIdleService;