adobe/brackets

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

Summary

Maintainability
F
1 wk
Test Coverage

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

/*
 * Copyright (c) 2012 - present Adobe Systems Incorporated. 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: Minor
Found in src/extensions/default/JavaScriptQuickEdit/unittests.js - About 6 hrs to fix

    Function toHaveInlineEditorRange has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                        toHaveInlineEditorRange: function (range) {
                            var i = 0,
                                editor = this.actual,
                                hidden,
                                lineCount = editor.lineCount(),
    Severity: Minor
    Found in src/extensions/default/JavaScriptQuickEdit/unittests.js - About 1 hr to fix

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

                      function expectParameterHint(expectedParams, expectedParameter) {
                          var requestHints = undefined,
                              request = null;
      
                          function expectHint(hint) {
      Severity: Minor
      Found in src/extensions/default/JavaScriptQuickEdit/unittests.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (!hidden) {
                                            shouldHide.push(i); // lines below end line should be hidden
                                        }
        Severity: Major
        Found in src/extensions/default/JavaScriptQuickEdit/unittests.js - About 45 mins to fix

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

                          function expectParameterHint(expectedParams, expectedParameter) {
                              var requestHints = undefined,
                                  request = null;
          
                              function expectHint(hint) {
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 1 other location - About 2 days to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 376..425

          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 382.

          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

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

          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

                      it("should open a function with  form: functionName: function()", function () {
                          initInlineTest("test1main.js", 2);
          
                          runs(function () {
                              var inlineWidget = EditorManager.getCurrentFullEditor().getInlineWidgets()[0];
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 2 other locations - About 4 hrs to fix
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 240..250
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 252..262

          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 119.

          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

                      it("should open a function with  form: function functionName()", function () {
                          initInlineTest("test1main.js", 0);
          
                          runs(function () {
                              var inlineWidget = EditorManager.getCurrentFullEditor().getInlineWidgets()[0];
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 2 other locations - About 4 hrs to fix
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 252..262
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 264..274

          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 119.

          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

                      it("should open a function with  form: functionName = function()", function () {
                          initInlineTest("test1main.js", 1);
          
                          runs(function () {
                              var inlineWidget = EditorManager.getCurrentFullEditor().getInlineWidgets()[0];
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 2 other locations - About 4 hrs to fix
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 240..250
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 264..274

          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 119.

          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(oldLocation, 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/JavaScriptQuickEdit/unittests.js and 2 other locations - About 4 hrs to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 330..337
          src/extensions/default/PhpTooling/unittests.js on lines 390..397

          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 hintsPresentExact(hintObj, expectedHints) {
                              _waitForHints(hintObj, function (hintList) {
                                  expect(hintList).toBeTruthy();
                                  expect(hintList.length).toBe(expectedHints.length);
                                  expectedHints.forEach(function (expectedHint, index) {
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 1 other location - About 3 hrs to fix
          src/extensions/default/JavaScriptCodeHints/unittests.js on lines 244..252

          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 114.

          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

                          SpecRunnerUtils.createTestWindowAndRun(this, function (w) {
                              testWindow          = w;
                              EditorManager       = testWindow.brackets.test.EditorManager;
                              CommandManager      = testWindow.brackets.test.CommandManager;
                              JSUtils             = testWindow.brackets.test.JSUtils;
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 1 other location - About 2 hrs to fix
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 541..546

          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 82.

          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

                          SpecRunnerUtils.createTestWindowAndRun(this, function (w) {
                              testWindow = w;
                              CommandManager      = testWindow.brackets.test.CommandManager;
                              EditorManager       = testWindow.brackets.test.EditorManager;
                              PerfUtils           = testWindow.brackets.test.PerfUtils;
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 1 other location - About 2 hrs to fix
          src/extensions/default/JavaScriptQuickEdit/unittests.js on lines 120..125

          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 82.

          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

                      afterEach(function () {
                          testWindow      = null;
                          CommandManager  = null;
                          EditorManager   = null;
                          PerfUtils       = null;
          Severity: Major
          Found in src/extensions/default/JavaScriptQuickEdit/unittests.js and 2 other locations - About 45 mins to fix
          src/extensions/default/JSLint/unittests.js on lines 63..69
          src/extensions/default/RemoteFileAdapter/unittests.js on lines 86..92

          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 50.

          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