Global Metrics

path: .metrics.mi.mi_visual_studio
old: 32.54672388874765
new: 32.92558220084926

path: .metrics.mi.mi_original
old: 55.65489784975848
new: 56.302745563452234

path: .metrics.mi.mi_sei
old: 43.53140873141943
new: 47.39226422526532

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

path: .metrics.nexits.average
old: null
new: 0.375

path: .metrics.cyclomatic.sum
old: 2.0
new: 13.0

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

path: .metrics.nom.total
old: 0.0
new: 8.0

path: .metrics.nom.functions
old: 0.0
new: 8.0

path: .metrics.halstead.N1
old: 186.0
new: 111.0

path: .metrics.halstead.difficulty
old: 13.444444444444445
new: 13.877551020408164

path: .metrics.halstead.purity_ratio
old: 0.9634700579048838
new: 1.7302080732737

path: .metrics.halstead.vocabulary
old: 56.0
new: 65.0

path: .metrics.halstead.n2
old: 45.0
new: 49.0

path: .metrics.halstead.volume
old: 1718.9770569290506
new: 1180.384091353577

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

path: .metrics.halstead.estimated_program_length
old: 285.1871371398456
new: 339.1207823616452

path: .metrics.halstead.time
old: 1283.92730795318
new: 910.046691746522

path: .metrics.halstead.effort
old: 23110.69154315724
new: 16380.840451437396

path: .metrics.halstead.bugs
old: 0.27045024093887454
new: 0.21499888064249

path: .metrics.halstead.N2
old: 110.0
new: 85.0

path: .metrics.halstead.level
old: 0.0743801652892562
new: 0.07205882352941177

path: .metrics.halstead.length
old: 296.0
new: 196.0

path: .metrics.loc.cloc
old: 36.0
new: 38.0

path: .metrics.loc.blank
old: 25.0
new: 23.0

path: .metrics.loc.sloc
old: 110.0
new: 102.0

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

path: .metrics.loc.ploc
old: 49.0
new: 41.0

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

path: .metrics.cognitive.average
old: null
new: 0.125

path: .metrics.nargs.average
old: null
new: 0.75

path: .metrics.nargs.sum
old: 0.0
new: 6.0

Spaces Data

Minimal test - lines (21, 98)

path: .spaces[0].metrics.nargs.average
old: null
new: 0.75

path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 6.0

path: .spaces[0].metrics.mi.mi_sei
old: 46.43376259009531
new: 55.30033292356288

path: .spaces[0].metrics.mi.mi_visual_studio
old: 34.53621114503594
new: 35.81179316049213

path: .spaces[0].metrics.mi.mi_original
old: 59.05692105801147
new: 61.23816630444155

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

path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 12.0

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

path: .spaces[0].metrics.nexits.average
old: null
new: 0.375

path: .spaces[0].metrics.cognitive.average
old: null
new: 0.125

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

path: .spaces[0].metrics.halstead.difficulty
old: 13.686046511627907
new: 13.565217391304348

path: .spaces[0].metrics.halstead.purity_ratio
old: 0.9262222943931756
new: 1.7193721620466087

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

path: .spaces[0].metrics.halstead.length
old: 293.0
new: 185.0

path: .spaces[0].metrics.halstead.volume
old: 1686.1820381338962
new: 1101.5263174215718

path: .spaces[0].metrics.halstead.time
old: 1282.0647667206692
new: 830.135775448141

path: .spaces[0].metrics.halstead.estimated_program_length
old: 271.3831322572005
new: 318.0838499786226

path: .spaces[0].metrics.halstead.N1
old: 186.0
new: 107.0

path: .spaces[0].metrics.halstead.N2
old: 107.0
new: 78.0

path: .spaces[0].metrics.halstead.level
old: 0.07306711979609176
new: 0.07371794871794872

path: .spaces[0].metrics.halstead.effort
old: 23077.165800972045
new: 14942.443958066538

path: .spaces[0].metrics.halstead.bugs
old: 0.2701886235355663
new: 0.2022211158110434

path: .spaces[0].metrics.halstead.n2
old: 43.0
new: 46.0

path: .spaces[0].metrics.halstead.vocabulary
old: 54.0
new: 62.0

path: .spaces[0].metrics.loc.cloc
old: 26.0
new: 31.0

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

path: .spaces[0].metrics.loc.sloc
old: 91.0
new: 78.0

path: .spaces[0].metrics.loc.ploc
old: 43.0
new: 33.0

path: .spaces[0].metrics.loc.blank
old: 22.0
new: 14.0

path: .spaces[0].metrics.nom.functions
old: 0.0
new: 8.0

path: .spaces[0].metrics.nom.total
old: 0.0
new: 8.0

Code

class nsPrintSettingsX : public nsPrintSettings {
 public:
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_PRINTSETTINGSX_IID)
  NS_DECL_ISUPPORTS_INHERITED

  nsPrintSettingsX();
  explicit nsPrintSettingsX(const PrintSettingsInitializer& aSettings);

  nsresult Init() { return NS_OK; }

  void SetDestination(uint16_t aDestination) { mDestination = aDestination; }
  void GetDestination(uint16_t* aDestination) { *aDestination = mDestination; }

  void SetDisposition(const nsString& aDisposition) { mDisposition = aDisposition; }
  void GetDisposition(nsString& aDisposition) { aDisposition = mDisposition; }

  // Get a Cocoa NSPrintInfo that is configured with our current settings.
  // This follows Create semantics, so the caller is responsible to release
  // the returned object when no longer required.
  //
  // Pass true for aWithScaling to have the print scaling factor included in
  // the returned printInfo. Normally we pass false, as scaling is handled
  // by Gecko and we don't want the Cocoa print system to impose scaling again
  // on the output, but if we're retrieving the info in order to populate the
  // system print UI, then we do want to know about it.
  NSPrintInfo* CreateOrCopyPrintInfo(bool aWithScaling = false);

  // Update our internal settings to reflect the properties of the given
  // NSPrintInfo.
  //
  // If aAdoptPrintInfo is set, the given NSPrintInfo will be retained and
  // returned by subsequent CreateOrCopyPrintInfo calls, which is required
  // for custom settings from the OS print dialog to be passed through to
  // print jobs. However, this means that subsequent changes to print settings
  // via the generic nsPrintSettings methods will NOT be reflected in the
  // resulting NSPrintInfo.
  void SetFromPrintInfo(NSPrintInfo* aPrintInfo, bool aAdoptPrintInfo);

 protected:
  virtual ~nsPrintSettingsX() {
    if (mSystemPrintInfo) {
      [mSystemPrintInfo release];
    }
  };

  nsPrintSettingsX& operator=(const nsPrintSettingsX& rhs);

  nsresult _Clone(nsIPrintSettings** _retval) override;
  nsresult _Assign(nsIPrintSettings* aPS) override;

  int GetCocoaUnit(int16_t aGeckoUnit);

  double PaperSizeFromCocoaPoints(double aPointsValue) {
    return aPointsValue * (mPaperSizeUnit == kPaperSizeInches ? 1.0 / 72.0 : 25.4 / 72.0);
  }

  double CocoaPointsFromPaperSize(double aSizeUnitValue) {
    return aSizeUnitValue * (mPaperSizeUnit == kPaperSizeInches ? 72.0 : 72.0 / 25.4);
  }

  // Needed to correctly track the various job dispositions (spool, preview,
  // save to file) that the user can choose via the system print dialog.
  // Unfortunately it seems to be necessary to set both the Cocoa "job
  // disposition" and the PrintManager "destination type" in order for all the
  // various workflows such as "Save to Web Receipts" to work.
  nsString mDisposition;
  uint16_t mDestination;

  // If the user has used the system print UI, we retain a reference to its
  // printInfo because it may contain settings that we don't know how to handle
  // and that will be lost if we round-trip through nsPrintSettings fields.
  // We'll use this printInfo if asked to run a print job.
  //
  // This "wrapped" printInfo is NOT serialized or copied when printSettings
  // objects are passed around; it is used only by the settings object to which
  // it was originally passed.
  NSPrintInfo* mSystemPrintInfo = nullptr;
};