adobe/brackets

View on GitHub
src/extensions/default/PhpTooling/unittests.js

Summary

Maintainability
F
6 days
Test Coverage

File unittests.js has 571 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2019 - present Adobe. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
Severity: Major
Found in src/extensions/default/PhpTooling/unittests.js - About 1 day to fix

    Function expectParameterHint has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function expectParameterHint(expectedParams, expectedParameter) {
                var requestStatus = null;
                var request,
                    complete = false;
                runs(function () {
    Severity: Minor
    Found in src/extensions/default/PhpTooling/unittests.js - About 1 hr to fix

      Function expectSymbols has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function expectSymbols(provider, query, expectedSymbols) {
                  var requestStatus = null;
                  var request,
                      matcher;
      
      
      Severity: Minor
      Found in src/extensions/default/PhpTooling/unittests.js - About 1 hr to fix

        Function expectReferences has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function expectReferences(referencesExpected) {
                    var refPromise,
                        results = null,
                        complete = false;
                    runs(function () {
        Severity: Minor
        Found in src/extensions/default/PhpTooling/unittests.js - About 1 hr to fix

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

                  function _waitForHints(hintObj, callback) {
                      var complete = false,
                          hintList = null;
          
                      if (hintObj.hasOwnProperty("hints")) {
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 2 other locations - About 4 hrs to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 137..156
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 308..327

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 134.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

                      _waitForJump(jumpPromise, function (newCursor) {
                          expect(newCursor.line).toBe(expectedLocation.line);
                          expect(newCursor.ch).toBe(expectedLocation.ch);
                          if (expectedLocation.file) {
                              var activeEditor = EditorManager.getActiveEditor();
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 2 other locations - About 4 hrs to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 330..337
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 441..448

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 116.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  function _waitForJump(jumpPromise, callback) {
                      var cursor = null,
                          complete = false;
          
                      jumpPromise.done(function () {
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 3 hrs to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 298..313

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 113.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          results[testFolder + "test/test2.php"] = {matches: [
                              {
                                  start: {line: 34, ch: 0},
                                  end: {line: 34, ch: 26},
                                  line: "watchReferences();"
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 3 hrs to fix
          src/extensions/default/PhpTooling/unittests.js on lines 613..625

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          results[testFolder + "test/test2.php"] = {matches: [
                              {
                                  start: {line: 34, ch: 0},
                                  end: {line: 34, ch: 17},
                                  line: "watchReferences();"
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 3 hrs to fix
          src/extensions/default/PhpTooling/unittests.js on lines 644..656

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      runs(function () {
                          refPromise = (new DefaultProviders.ReferencesProvider(phpToolingExtension.getClient())).getReferences();
                          refPromise.done(function (resp) {
                              complete = true;
                              results = resp;
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 2 hrs to fix
          src/extensions/default/PhpTooling/unittests.js on lines 287..296

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 92.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      runs(function () {
                          request = (new DefaultProviders.ParameterHintsProvider(phpToolingExtension.getClient()))
                              .getParameterHints();
                          request.done(function (status) {
                              complete = true;
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 2 hrs to fix
          src/extensions/default/PhpTooling/unittests.js on lines 405..413

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 92.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  function _indexOf(hintList, hint) {
                      var index = -1,
                          counter = 0;
          
                      for (counter; counter < hintList.length; counter++) {
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 2 hrs to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 115..126

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 87.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                      _waitForHints(hintObj, function (hintList) {
                          expect(hintList).toBeTruthy();
                          expectedHints.forEach(function (expectedHint) {
                              expect(_indexOf(hintList, expectedHint)).not.toBe(-1);
                          });
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 1 hr to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 204..209

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 71.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              var SpecRunnerUtils = brackets.getModule("spec/SpecRunnerUtils"),
                  Strings         = brackets.getModule("strings"),
                  FileUtils       = brackets.getModule("file/FileUtils"),
                  StringUtils     = brackets.getModule("utils/StringUtils"),
                  StringMatch     = brackets.getModule("utils/StringMatch");
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 3 other locations - About 1 hr to fix
          src/extensions/default/AutoUpdate/UpdateInfoBar.js on lines 27..32
          src/extensions/default/InAppNotifications/main.js on lines 31..36
          src/extensions/default/PhpTooling/PHPSymbolProviders.js on lines 29..33

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 67.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          results[testFolder + "test/test2.php"] = {matches: [
                              {
                                  start: {line: 27, ch: 0},
                                  end: {line: 27, ch: 18},
                                  line: "watchparameterhint()"
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 1 hr to fix
          src/extensions/default/PhpTooling/unittests.js on lines 657..664

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          results[testFolder + "test/test3.php"] = {matches: [
                              {
                                  start: {line: 11, ch: 0},
                                  end: {line: 11, ch: 26},
                                  line: "watchReferences();"
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 1 hr to fix
          src/extensions/default/PhpTooling/unittests.js on lines 587..594

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      runs(function() {
                          testEditor = EditorManager.getActiveEditor();
                          testEditor.setCursorPos({ line: 17, ch: 2 });
                          expecthintsPresent(["fopen", "for", "foreach"]);
                      });
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 1 hr to fix
          src/extensions/default/PhpTooling/unittests.js on lines 519..523

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 59.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      runs(function() {
                          testEditor = EditorManager.getActiveEditor();
                          testEditor.setCursorPos({ line: 15, ch: 3 });
                          expecthintsPresent(["$A11", "$A12", "$A13"]);
                      });
          Severity: Major
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 1 hr to fix
          src/extensions/default/PhpTooling/unittests.js on lines 527..531

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 59.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      if (btn[1].classList.contains("primary")) {
                          openBtn = btn[1];
                          cancelBtn = btn[0];
                      }
          Severity: Minor
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 30 mins to fix
          src/extensions/default/PhpTooling/unittests.js on lines 127..130

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      if (btn[0].classList.contains("primary")) {
                          openBtn = btn[0];
                          cancelBtn = btn[1];
                      }
          Severity: Minor
          Found in src/extensions/default/PhpTooling/unittests.js and 1 other location - About 30 mins to fix
          src/extensions/default/PhpTooling/unittests.js on lines 132..135

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status