Global Metrics

path: .metrics.mi.mi_original
old: 81.5539636871776
new: 48.44317242854825

path: .metrics.mi.mi_sei
old: 84.93640723990094
new: 27.9574377790694

path: .metrics.mi.mi_visual_studio
old: 47.69237642525006
new: 28.329340601490205

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

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

path: .metrics.halstead.time
old: 149.11702767493497
new: 1484.1337687860712

path: .metrics.halstead.estimated_program_length
old: 108.27793097483524
new: 699.3258553965352

path: .metrics.halstead.bugs
old: 0.0643791503779922
new: 0.2978807554219873

path: .metrics.halstead.length
old: 67.0
new: 375.0

path: .metrics.halstead.n2
old: 18.0
new: 99.0

path: .metrics.halstead.difficulty
old: 8.333333333333334
new: 10.484848484848484

path: .metrics.halstead.effort
old: 2684.106498148829
new: 26714.40783814928

path: .metrics.halstead.N2
old: 30.0
new: 173.0

path: .metrics.halstead.n1
old: 10.0
new: 12.0

path: .metrics.halstead.volume
old: 322.09277977785945
new: 2547.90594988129

path: .metrics.halstead.N1
old: 37.0
new: 202.0

path: .metrics.halstead.level
old: 0.12
new: 0.0953757225433526

path: .metrics.halstead.purity_ratio
old: 1.6160885220124663
new: 1.8648689477240936

path: .metrics.halstead.vocabulary
old: 28.0
new: 111.0

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

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

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

path: .metrics.loc.cloc
old: 16.0
new: 32.0

path: .metrics.loc.sloc
old: 37.0
new: 145.0

path: .metrics.loc.blank
old: 7.0
new: 40.0

path: .metrics.loc.ploc
old: 14.0
new: 73.0

Spaces Data

Minimal test - lines (43, 43)

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

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

path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 158.02045369261705
new: 154.24412008219068

path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 92.40962204246613
new: 90.2012398141466

path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 152.37629276875444
new: 146.92819499625

path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 5.0
new: 8.0

path: .spaces[0].spaces[1].metrics.halstead.length
old: 5.0
new: 8.0

path: .spaces[0].spaces[1].metrics.halstead.N2
old: 1.0
new: 3.0

path: .spaces[0].spaces[1].metrics.halstead.effort
old: 23.21928094887362
new: 60.0

path: .spaces[0].spaces[1].metrics.halstead.n1
old: 4.0
new: 5.0

path: .spaces[0].spaces[1].metrics.halstead.n2
old: 1.0
new: 3.0

path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 8.0
new: 16.36452797660028

path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.5
new: 0.4

path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.002712967490108627
new: 0.005108729549290353

path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 2.0
new: 2.5

path: .spaces[0].spaces[1].metrics.halstead.time
old: 1.289960052715201
new: 3.3333333333333335

path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.6
new: 2.045565997075035

path: .spaces[0].spaces[1].metrics.halstead.volume
old: 11.60964047443681
new: 24.0

path: .spaces[0].spaces[1].metrics.halstead.N1
old: 4.0
new: 5.0

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

Code

  GtkPrintSettings* GetGtkPrintSettings() { return mPrintSettings; };

Minimal test - lines (28, 141)

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

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

path: .spaces[0].metrics.loc.blank
old: 3.0
new: 29.0

path: .spaces[0].metrics.loc.sloc
old: 17.0
new: 114.0

path: .spaces[0].metrics.loc.ploc
old: 9.0
new: 62.0

path: .spaces[0].metrics.loc.cloc
old: 5.0
new: 23.0

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

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

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

path: .spaces[0].metrics.halstead.bugs
old: 0.06132352464651408
new: 0.28826713152128547

path: .spaces[0].metrics.halstead.n1
old: 10.0
new: 12.0

path: .spaces[0].metrics.halstead.n2
old: 15.0
new: 95.0

path: .spaces[0].metrics.halstead.length
old: 62.0
new: 362.0

path: .spaces[0].metrics.halstead.time
old: 138.62770699846027
new: 1412.869554728914

path: .spaces[0].metrics.halstead.N1
old: 36.0
new: 197.0

path: .spaces[0].metrics.halstead.effort
old: 2495.298725972285
new: 25431.65198512045

path: .spaces[0].metrics.halstead.level
old: 0.1153846153846154
new: 0.09595959595959597

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.4810103206935712
new: 1.842971913812414

path: .spaces[0].metrics.halstead.volume
old: 287.9190837660329
new: 2440.411049077215

path: .spaces[0].metrics.halstead.N2
old: 26.0
new: 165.0

path: .spaces[0].metrics.halstead.difficulty
old: 8.666666666666666
new: 10.421052631578949

path: .spaces[0].metrics.halstead.estimated_program_length
old: 91.8226398830014
new: 667.1558328000939

path: .spaces[0].metrics.halstead.vocabulary
old: 25.0
new: 107.0

path: .spaces[0].metrics.mi.mi_original
old: 94.96601052241748
new: 52.79399194846427

path: .spaces[0].metrics.mi.mi_visual_studio
old: 55.53567866808041
new: 30.873679502025883

path: .spaces[0].metrics.mi.mi_sei
old: 98.84936386298668
new: 32.92405160725573

Code

class nsPrintSettingsGTK : public nsPrintSettings {
 public:
  NS_DECL_ISUPPORTS_INHERITED
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_PRINTSETTINGSGTK_IID)

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

  // We're overriding these methods because we want to read/write with GTK
  // objects, not local variables. This allows a simpler settings implementation
  // between Gecko and GTK.

  GtkPageSetup* GetGtkPageSetup() { return mPageSetup; };
  void SetGtkPageSetup(GtkPageSetup* aPageSetup);

  GtkPrintSettings* GetGtkPrintSettings() { return mPrintSettings; };
  void SetGtkPrintSettings(GtkPrintSettings* aPrintSettings);

  GtkPrinter* GetGtkPrinter() { return mGTKPrinter; };
  void SetGtkPrinter(GtkPrinter* aPrinter);

  // Reversed, color, orientation and file name are all stored in the
  // GtkPrintSettings. Orientation is also stored in the GtkPageSetup and its
  // setting takes priority when getting the orientation.
  NS_IMETHOD GetPrintReversed(bool* aPrintReversed) override;
  NS_IMETHOD SetPrintReversed(bool aPrintReversed) override;

  NS_IMETHOD GetPrintInColor(bool* aPrintInColor) override;
  NS_IMETHOD SetPrintInColor(bool aPrintInColor) override;

  NS_IMETHOD GetOrientation(int32_t* aOrientation) override;
  NS_IMETHOD SetOrientation(int32_t aOrientation) override;

  NS_IMETHOD GetToFileName(nsAString& aToFileName) override;
  NS_IMETHOD SetToFileName(const nsAString& aToFileName) override;

  // Gets/Sets the printer name in the GtkPrintSettings. If no printer name is
  // specified there, you will get back the name of the current internal
  // GtkPrinter.
  NS_IMETHOD GetPrinterName(nsAString& Printer) override;
  NS_IMETHOD SetPrinterName(const nsAString& aPrinter) override;

  // Number of copies is stored/gotten from the GtkPrintSettings.
  NS_IMETHOD GetNumCopies(int32_t* aNumCopies) override;
  NS_IMETHOD SetNumCopies(int32_t aNumCopies) override;

  NS_IMETHOD GetScaling(double* aScaling) override;
  NS_IMETHOD SetScaling(double aScaling) override;

  // A name recognised by GTK is strongly advised here, as this is used to
  // create a GtkPaperSize.
  NS_IMETHOD GetPaperId(nsAString& aPaperId) override;
  NS_IMETHOD SetPaperId(const nsAString& aPaperId) override;

  NS_IMETHOD SetUnwriteableMarginInTwips(
      nsIntMargin& aUnwriteableMargin) override;
  NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop) override;
  NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) override;
  NS_IMETHOD SetUnwriteableMarginBottom(
      double aUnwriteableMarginBottom) override;
  NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight) override;

  NS_IMETHOD GetPaperWidth(double* aPaperWidth) override;
  NS_IMETHOD SetPaperWidth(double aPaperWidth) override;

  NS_IMETHOD GetPaperHeight(double* aPaperHeight) override;
  NS_IMETHOD SetPaperHeight(double aPaperHeight) override;

  NS_IMETHOD SetPaperSizeUnit(int16_t aPaperSizeUnit) override;

  NS_IMETHOD GetEffectivePageSize(double* aWidth, double* aHeight) override;

  NS_IMETHOD SetupSilentPrinting() override;

  NS_IMETHOD SetPageRanges(const nsTArray&) override;
  NS_IMETHOD GetPageRanges(nsTArray&) override;

  NS_IMETHOD GetResolution(int32_t* aResolution) override;
  NS_IMETHOD SetResolution(int32_t aResolution) override;

  NS_IMETHOD GetDuplex(int32_t* aDuplex) override;
  NS_IMETHOD SetDuplex(int32_t aDuplex) override;

  NS_IMETHOD GetOutputFormat(int16_t* aOutputFormat) override;

 protected:
  virtual ~nsPrintSettingsGTK();

  nsPrintSettingsGTK(const nsPrintSettingsGTK& src);
  nsPrintSettingsGTK& operator=(const nsPrintSettingsGTK& rhs);

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

  GtkUnit GetGTKUnit(int16_t aGeckoUnit);
  void SaveNewPageSize();

  /**
   * Re-initialize mUnwriteableMargin with values from mPageSetup.
   * Should be called whenever mPageSetup is initialized or overwritten.
   */
  void InitUnwriteableMargin();

  /**
   * On construction:
   * - mPrintSettings and mPageSetup are just new objects with defaults
   *   determined by GTK.
   * - mGTKPrinter is nullptr!!! Remember to be careful when accessing this
   *   property.
   */
  GtkPageSetup* mPageSetup;
  GtkPrintSettings* mPrintSettings;
  GtkPrinter* mGTKPrinter;
};

Minimal test - lines (40, 40)

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

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

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

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

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

path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: null
new: 146.92819499625

path: .spaces[0].spaces[0].metrics.mi.mi_original
old: null
new: 154.24412008219068

path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: null
new: 90.2012398141466

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

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

path: .spaces[0].spaces[0].metrics.halstead.time
old: 0.0
new: 3.3333333333333335

path: .spaces[0].spaces[0].metrics.halstead.N1
old: 0.0
new: 5.0

path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: null
new: 2.045565997075035

path: .spaces[0].spaces[0].metrics.halstead.volume
old: 0.0
new: 24.0

path: .spaces[0].spaces[0].metrics.halstead.effort
old: 0.0
new: 60.0

path: .spaces[0].spaces[0].metrics.halstead.level
old: null
new: 0.4

path: .spaces[0].spaces[0].metrics.halstead.N2
old: 1.0
new: 3.0

path: .spaces[0].spaces[0].metrics.halstead.n2
old: 1.0
new: 3.0

path: .spaces[0].spaces[0].metrics.halstead.length
old: 1.0
new: 8.0

path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.005108729549290353

path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: null
new: 16.36452797660028

path: .spaces[0].spaces[0].metrics.halstead.n1
old: 0.0
new: 5.0

path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 0.0
new: 2.5

path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 8.0

Code

  GtkPageSetup* GetGtkPageSetup() { return mPageSetup; };