Global Metrics

path: .metrics.nexits.average
old: 1.3333333333333333
new: 1.5357142857142858

path: .metrics.nexits.sum
old: 8.0
new: 43.0

path: .metrics.halstead.vocabulary
old: 70.0
new: 220.0

path: .metrics.halstead.bugs
old: 0.34659891884461647
new: 1.6190615427968595

path: .metrics.halstead.volume
old: 1538.4500372531866
new: 10380.333857841895

path: .metrics.halstead.N1
old: 134.0
new: 747.0

path: .metrics.halstead.length
old: 251.0
new: 1334.0

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

path: .metrics.halstead.level
old: 0.04588394062078273
new: 0.03066439522998296

path: .metrics.halstead.time
old: 1862.7311725565544
new: 18806.34560047282

path: .metrics.halstead.difficulty
old: 21.794117647058822
new: 32.611111111111114

path: .metrics.halstead.n2
old: 51.0
new: 198.0

path: .metrics.halstead.N2
old: 117.0
new: 587.0

path: .metrics.halstead.effort
old: 33529.16110601798
new: 338514.2208085108

path: .metrics.halstead.estimated_program_length
old: 370.0043151959744
new: 1608.7201063857833

path: .metrics.halstead.purity_ratio
old: 1.4741207776732046
new: 1.2059371112337207

path: .metrics.nom.total
old: 6.0
new: 28.0

path: .metrics.nom.functions
old: 6.0
new: 28.0

path: .metrics.cyclomatic.sum
old: 18.0
new: 63.0

path: .metrics.cyclomatic.average
old: 2.5714285714285716
new: 1.96875

path: .metrics.loc.lloc
old: 13.0
new: 138.0

path: .metrics.loc.ploc
old: 54.0
new: 309.0

path: .metrics.loc.blank
old: 17.0
new: 71.0

path: .metrics.loc.sloc
old: 98.0
new: 408.0

path: .metrics.loc.cloc
old: 27.0
new: 28.0

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

path: .metrics.cognitive.average
old: 0.16666666666666666
new: 1.0714285714285714

path: .metrics.mi.mi_original
old: 54.4231671053784
new: 11.039596511842204

path: .metrics.mi.mi_visual_studio
old: 31.826413511917192
new: 6.4559043928901785

path: .metrics.mi.mi_sei
old: 40.97095803676447
new: -33.619908979383816

path: .metrics.nargs.sum
old: 13.0
new: 33.0

path: .metrics.nargs.average
old: 2.1666666666666665
new: 1.1785714285714286

Spaces Data

Minimal test - lines (68, 98)

path: .spaces[1].metrics.mi.mi_sei
old: 108.97210631365388
new: 66.22084056220561

path: .spaces[1].metrics.mi.mi_original
old: 127.79381192982352
new: 81.9563444829102

path: .spaces[1].metrics.mi.mi_visual_studio
old: 74.733223350774
new: 47.92768683211122

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

path: .spaces[1].metrics.loc.blank
old: 0.0
new: 4.0

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

path: .spaces[1].metrics.loc.sloc
old: 3.0
new: 31.0

path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 3.0

path: .spaces[1].metrics.loc.ploc
old: 3.0
new: 24.0

path: .spaces[1].metrics.nargs.sum
old: 3.0
new: 2.0

path: .spaces[1].metrics.nargs.average
old: 3.0
new: 1.0

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

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

path: .spaces[1].metrics.cyclomatic.sum
old: 3.0
new: 5.0

path: .spaces[1].metrics.cyclomatic.average
old: 3.0
new: 1.6666666666666667

path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 2.0

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

path: .spaces[1].metrics.halstead.level
old: 0.0923076923076923
new: 0.08333333333333333

path: .spaces[1].metrics.halstead.vocabulary
old: 16.0
new: 40.0

path: .spaces[1].metrics.halstead.purity_ratio
old: 1.680312274248295
new: 1.878492082564472

path: .spaces[1].metrics.halstead.effort
old: 1256.6666666666667
new: 5939.271753894297

path: .spaces[1].metrics.halstead.bugs
old: 0.03881731354607276
new: 0.10932031556314412

path: .spaces[1].metrics.halstead.N1
old: 16.0
new: 53.0

path: .spaces[1].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 174.6997636784959

path: .spaces[1].metrics.halstead.N2
old: 13.0
new: 40.0

path: .spaces[1].metrics.halstead.length
old: 29.0
new: 93.0

path: .spaces[1].metrics.halstead.volume
old: 116.0
new: 494.93931282452473

path: .spaces[1].metrics.halstead.time
old: 69.81481481481482
new: 329.9595418830165

path: .spaces[1].metrics.halstead.difficulty
old: 10.833333333333334
new: 12.0

path: .spaces[1].metrics.halstead.n1
old: 10.0
new: 15.0

path: .spaces[1].metrics.halstead.n2
old: 6.0
new: 25.0

Code

class nsBaseFilePicker::AsyncShowFilePicker : public mozilla::Runnable {
 public:
  AsyncShowFilePicker(nsBaseFilePicker* aFilePicker,
                      nsIFilePickerShownCallback* aCallback)
      : mozilla::Runnable("AsyncShowFilePicker"),
        mFilePicker(aFilePicker),
        mCallback(aCallback) {}

  NS_IMETHOD Run() override {
    NS_ASSERTION(NS_IsMainThread(),
                 "AsyncShowFilePicker should be on the main thread!");

    // It's possible that some widget implementations require GUI operations
    // to be on the main thread, so that's why we're not dispatching to another
    // thread and calling back to the main after it's done.
    int16_t result = nsIFilePicker::returnCancel;
    nsresult rv = mFilePicker->Show(&result);
    if (NS_FAILED(rv)) {
      NS_ERROR("FilePicker's Show() implementation failed!");
    }

    if (mCallback) {
      mCallback->Done(result);
    }
    return NS_OK;
  }

 private:
  RefPtr mFilePicker;
  RefPtr mCallback;
};

Minimal test - lines (149, 164)

path: .spaces[4].metrics.halstead.difficulty
old: 8.076923076923077
new: 8.0

path: .spaces[4].metrics.halstead.estimated_program_length
old: 81.32499728470782
new: 135.25821588700785

path: .spaces[4].metrics.halstead.time
old: 117.72859962558636
new: 132.27522357428833

path: .spaces[4].metrics.halstead.N2
old: 21.0
new: 28.0

path: .spaces[4].metrics.halstead.purity_ratio
old: 1.4021551255984106
new: 2.292512133678099

path: .spaces[4].metrics.halstead.vocabulary
old: 23.0
new: 33.0

path: .spaces[4].metrics.halstead.effort
old: 2119.1147932605545
new: 2380.95402433719

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

path: .spaces[4].metrics.halstead.length
old: 58.0
new: 59.0

path: .spaces[4].metrics.halstead.N1
old: 37.0
new: 31.0

path: .spaces[4].metrics.halstead.level
old: 0.1238095238095238
new: 0.125

path: .spaces[4].metrics.halstead.n2
old: 13.0
new: 21.0

path: .spaces[4].metrics.halstead.volume
old: 262.36659345130676
new: 297.6192530421487

path: .spaces[4].metrics.halstead.bugs
old: 0.05499396937047243
new: 0.0594355224857608

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

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

path: .spaces[4].metrics.loc.lloc
old: 8.0
new: 6.0

path: .spaces[4].metrics.loc.sloc
old: 8.0
new: 16.0

path: .spaces[4].metrics.loc.ploc
old: 8.0
new: 12.0

path: .spaces[4].metrics.loc.blank
old: 0.0
new: 4.0

path: .spaces[4].metrics.nexits.average
old: 3.0
new: 1.0

path: .spaces[4].metrics.nexits.sum
old: 3.0
new: 1.0

path: .spaces[4].metrics.mi.mi_original
old: 107.43038479018784
new: 96.23582472452786

path: .spaces[4].metrics.mi.mi_sei
old: 79.6957108232022
new: 63.23991495332753

path: .spaces[4].metrics.mi.mi_visual_studio
old: 62.82478642701043
new: 56.278260072823315

path: .spaces[4].metrics.cyclomatic.average
old: 4.0
new: 1.0

path: .spaces[4].metrics.cyclomatic.sum
old: 4.0
new: 1.0

path: .spaces[4].metrics.nargs.average
old: 2.0
new: 3.0

path: .spaces[4].metrics.nargs.sum
old: 2.0
new: 3.0

Code

NS_IMETHODIMP nsBaseFilePicker::Init(mozIDOMWindowProxy* aParent,
                                     const nsAString& aTitle, int16_t aMode) {
  MOZ_ASSERT(aParent,
             "Null parent passed to filepicker, no file "
             "picker for you!");

  mParent = nsPIDOMWindowOuter::From(aParent);

  nsCOMPtr widget = WidgetUtils::DOMWindowToWidget(mParent);
  NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);

  mMode = aMode;
  InitNative(widget, aTitle);

  return NS_OK;
}

Minimal test - lines (167, 171)

path: .spaces[5].metrics.mi.mi_original
old: 129.81280273574149
new: 120.6497835562188

path: .spaces[5].metrics.mi.mi_sei
old: 111.6812546181432
new: 98.46181228827535

path: .spaces[5].metrics.mi.mi_visual_studio
old: 75.91391972850379
new: 70.55542898024491

path: .spaces[5].metrics.loc.ploc
old: 3.0
new: 5.0

path: .spaces[5].metrics.loc.sloc
old: 3.0
new: 5.0

path: .spaces[5].metrics.halstead.effort
old: 827.2840836201038
new: 700.9080397181915

path: .spaces[5].metrics.halstead.vocabulary
old: 15.0
new: 19.0

path: .spaces[5].metrics.halstead.volume
old: 85.95159310338741
new: 101.95026032264605

path: .spaces[5].metrics.halstead.difficulty
old: 9.625
new: 6.875

path: .spaces[5].metrics.halstead.n2
old: 4.0
new: 8.0

path: .spaces[5].metrics.halstead.length
old: 22.0
new: 24.0

path: .spaces[5].metrics.halstead.estimated_program_length
old: 46.05374780501027
new: 62.05374780501027

path: .spaces[5].metrics.halstead.level
old: 0.1038961038961039
new: 0.14545454545454545

path: .spaces[5].metrics.halstead.bugs
old: 0.029375269377163855
new: 0.026301838473294693

path: .spaces[5].metrics.halstead.time
old: 45.96022686778355
new: 38.93933553989953

path: .spaces[5].metrics.halstead.N1
old: 15.0
new: 14.0

path: .spaces[5].metrics.halstead.N2
old: 7.0
new: 10.0

path: .spaces[5].metrics.halstead.purity_ratio
old: 2.093352172955012
new: 2.5855728252087613

Code

nsBaseFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
  nsCOMPtr filePickerEvent =
      new AsyncShowFilePicker(this, aCallback);
  return NS_DispatchToMainThread(filePickerEvent);
}

Minimal test - lines (32, 62)

path: .spaces[0].metrics.halstead.difficulty
old: 8.25
new: 14.72

path: .spaces[0].metrics.halstead.length
old: 24.0
new: 107.0

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.834962500721156
new: 1.6831439695735335

path: .spaces[0].metrics.halstead.time
old: 42.975796551693705
new: 468.7977060752037

path: .spaces[0].metrics.halstead.n2
old: 6.0
new: 25.0

path: .spaces[0].metrics.halstead.N1
old: 13.0
new: 61.0

path: .spaces[0].metrics.halstead.volume
old: 93.76537429460444
new: 573.2580644941349

path: .spaces[0].metrics.halstead.estimated_program_length
old: 44.039100017307746
new: 180.0964047443681

path: .spaces[0].metrics.halstead.N2
old: 11.0
new: 46.0

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

path: .spaces[0].metrics.halstead.bugs
old: 0.028089437260899033
new: 0.1381605544098278

path: .spaces[0].metrics.halstead.effort
old: 773.5643379304867
new: 8438.358709353666

path: .spaces[0].metrics.halstead.level
old: 0.12121212121212122
new: 0.06793478260869565

path: .spaces[0].metrics.halstead.vocabulary
old: 15.0
new: 41.0

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

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

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

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

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

path: .spaces[0].metrics.loc.sloc
old: 3.0
new: 31.0

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

path: .spaces[0].metrics.loc.ploc
old: 3.0
new: 24.0

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

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

path: .spaces[0].metrics.mi.mi_sei
old: 110.56849403130713
new: 42.17420690814701

path: .spaces[0].metrics.mi.mi_visual_studio
old: 75.38031788034819
new: 47.6154737667242

path: .spaces[0].metrics.mi.mi_original
old: 128.9003435753954
new: 81.42246014109838

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

path: .spaces[0].metrics.nargs.average
old: 1.0
new: 4.0

Code

namespace {

nsresult LocalFileToDirectoryOrBlob(nsPIDOMWindowInner* aWindow,
                                    bool aIsDirectory, nsIFile* aFile,
                                    nsISupports** aResult) {
  MOZ_ASSERT(aWindow);

  if (aIsDirectory) {
#ifdef DEBUG
    bool isDir;
    aFile->IsDirectory(&isDir);
    MOZ_ASSERT(isDir);
#endif

    RefPtr directory = Directory::Create(aWindow->AsGlobal(), aFile);
    MOZ_ASSERT(directory);

    directory.forget(aResult);
    return NS_OK;
  }

  RefPtr file = File::CreateFromFile(aWindow->AsGlobal(), aFile);
  if (NS_WARN_IF(!file)) {
    return NS_ERROR_FAILURE;
  }

  file.forget(aResult);
  return NS_OK;
}

}  // anonymous namespace

Minimal test - lines (144, 145)

path: .spaces[3].metrics.nargs.average
old: 3.0
new: 0.0

path: .spaces[3].metrics.nargs.sum
old: 3.0
new: 0.0

path: .spaces[3].metrics.cyclomatic.sum
old: 3.0
new: 1.0

path: .spaces[3].metrics.cyclomatic.average
old: 3.0
new: 1.0

path: .spaces[3].metrics.halstead.difficulty
old: 10.833333333333334
new: 2.5

path: .spaces[3].metrics.halstead.length
old: 29.0
new: 13.0

path: .spaces[3].metrics.halstead.N2
old: 13.0
new: 5.0

path: .spaces[3].metrics.halstead.purity_ratio
old: 1.680312274248295
new: 1.78609853452874

path: .spaces[3].metrics.halstead.n2
old: 6.0
new: 5.0

path: .spaces[3].metrics.halstead.vocabulary
old: 16.0
new: 10.0

path: .spaces[3].metrics.halstead.N1
old: 16.0
new: 8.0

path: .spaces[3].metrics.halstead.level
old: 0.0923076923076923
new: 0.4

path: .spaces[3].metrics.halstead.bugs
old: 0.03881731354607276
new: 0.007557783918721112

path: .spaces[3].metrics.halstead.n1
old: 10.0
new: 5.0

path: .spaces[3].metrics.halstead.time
old: 69.81481481481482
new: 5.997925726879959

path: .spaces[3].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 23.21928094887362

path: .spaces[3].metrics.halstead.volume
old: 116.0
new: 43.18506523353571

path: .spaces[3].metrics.halstead.effort
old: 1256.6666666666667
new: 107.96266308383927

path: .spaces[3].metrics.mi.mi_original
old: 127.79381192982352
new: 139.96044311381488

path: .spaces[3].metrics.mi.mi_visual_studio
old: 74.733223350774
new: 81.84821234726016

path: .spaces[3].metrics.mi.mi_sei
old: 108.97210631365388
new: 126.32120506831431

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

path: .spaces[3].metrics.loc.ploc
old: 3.0
new: 2.0

path: .spaces[3].metrics.loc.sloc
old: 3.0
new: 2.0

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

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

Code

nsBaseFilePicker::nsBaseFilePicker()
    : mAddToRecentDocs(true), mMode(nsIFilePicker::modeOpen) {}

Minimal test - lines (100, 142)

path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 3.0

path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 0.75

path: .spaces[2].metrics.mi.mi_original
old: 127.79381192982352
new: 73.10542813931909

path: .spaces[2].metrics.mi.mi_visual_studio
old: 74.733223350774
new: 42.7517123621749

path: .spaces[2].metrics.mi.mi_sei
old: 108.97210631365388
new: 30.582545521883063

path: .spaces[2].metrics.nom.total
old: 1.0
new: 4.0

path: .spaces[2].metrics.nom.functions
old: 1.0
new: 4.0

path: .spaces[2].metrics.nargs.sum
old: 3.0
new: 5.0

path: .spaces[2].metrics.nargs.average
old: 3.0
new: 1.25

path: .spaces[2].metrics.nexits.sum
old: 1.0
new: 6.0

path: .spaces[2].metrics.nexits.average
old: 1.0
new: 1.5

path: .spaces[2].metrics.cyclomatic.sum
old: 3.0
new: 8.0

path: .spaces[2].metrics.cyclomatic.average
old: 3.0
new: 1.6

path: .spaces[2].metrics.halstead.N1
old: 16.0
new: 87.0

path: .spaces[2].metrics.halstead.N2
old: 13.0
new: 65.0

path: .spaces[2].metrics.halstead.vocabulary
old: 16.0
new: 50.0

path: .spaces[2].metrics.halstead.n1
old: 10.0
new: 17.0

path: .spaces[2].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 235.95187424008475

path: .spaces[2].metrics.halstead.n2
old: 6.0
new: 33.0

path: .spaces[2].metrics.halstead.bugs
old: 0.03881731354607276
new: 0.19695665428011488

path: .spaces[2].metrics.halstead.difficulty
old: 10.833333333333334
new: 16.742424242424242

path: .spaces[2].metrics.halstead.effort
old: 1256.6666666666667
new: 14362.75887325095

path: .spaces[2].metrics.halstead.length
old: 29.0
new: 152.0

path: .spaces[2].metrics.halstead.purity_ratio
old: 1.680312274248295
new: 1.5523149621058208

path: .spaces[2].metrics.halstead.volume
old: 116.0
new: 857.8661408457581

path: .spaces[2].metrics.halstead.time
old: 69.81481481481482
new: 797.9310485139417

path: .spaces[2].metrics.halstead.level
old: 0.0923076923076923
new: 0.05972850678733032

path: .spaces[2].metrics.loc.ploc
old: 3.0
new: 35.0

path: .spaces[2].metrics.loc.sloc
old: 3.0
new: 43.0

path: .spaces[2].metrics.loc.blank
old: 0.0
new: 8.0

path: .spaces[2].metrics.loc.lloc
old: 1.0
new: 10.0

Code

class nsBaseFilePickerEnumerator : public nsSimpleEnumerator {
 public:
  nsBaseFilePickerEnumerator(nsPIDOMWindowOuter* aParent,
                             nsISimpleEnumerator* iterator, int16_t aMode)
      : mIterator(iterator),
        mParent(aParent->GetCurrentInnerWindow()),
        mMode(aMode) {}

  const nsID& DefaultInterface() override { return NS_GET_IID(nsIFile); }

  NS_IMETHOD
  GetNext(nsISupports** aResult) override {
    nsCOMPtr tmp;
    nsresult rv = mIterator->GetNext(getter_AddRefs(tmp));
    NS_ENSURE_SUCCESS(rv, rv);

    if (!tmp) {
      return NS_OK;
    }

    nsCOMPtr localFile = do_QueryInterface(tmp);
    if (!localFile) {
      return NS_ERROR_FAILURE;
    }

    if (!mParent) {
      return NS_ERROR_FAILURE;
    }

    return LocalFileToDirectoryOrBlob(
        mParent, mMode == nsIFilePicker::modeGetFolder, localFile, aResult);
  }

  NS_IMETHOD
  HasMoreElements(bool* aResult) override {
    return mIterator->HasMoreElements(aResult);
  }

 private:
  nsCOMPtr mIterator;
  nsCOMPtr mParent;
  int16_t mMode;
};