adobe/brackets

View on GitHub
src/LiveDevelopment/Agents/RemoteFunctions.js

Summary

Maintainability
F
1 wk
Test Coverage

Function RemoteFunctions has a Cognitive Complexity of 234 (exceeds 5 allowed). Consider refactoring.
Open

function RemoteFunctions(config, remoteWSPort) {
    "use strict";

    var experimental;
    if (!config) {
Severity: Minor
Found in src/LiveDevelopment/Agents/RemoteFunctions.js - About 4 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function RemoteFunctions has 788 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function RemoteFunctions(config, remoteWSPort) {
    "use strict";

    var experimental;
    if (!config) {
Severity: Major
Found in src/LiveDevelopment/Agents/RemoteFunctions.js - About 3 days to fix

    File RemoteFunctions.js has 791 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: Major
    Found in src/LiveDevelopment/Agents/RemoteFunctions.js - About 1 day to fix

      Function _makeHighlightDiv has 179 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _makeHighlightDiv: function (element, doAnimation) {
                  var elementBounds = element.getBoundingClientRect(),
                      highlight = window.document.createElement("div"),
                      elementStyling = window.getComputedStyle(element),
                      transitionDuration = parseFloat(elementStyling.getPropertyValue('transition-duration')),
      Severity: Major
      Found in src/LiveDevelopment/Agents/RemoteFunctions.js - About 7 hrs to fix

        Function apply has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            DOMEditHandler.prototype.apply = function (edits) {
                var targetID,
                    targetElement,
                    childElement,
                    self = this;
        Severity: Major
        Found in src/LiveDevelopment/Agents/RemoteFunctions.js - About 3 hrs to fix

          Function _textReplace has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              DOMEditHandler.prototype._textReplace = function (targetElement, edit) {
                  function prevIgnoringHighlights(node) {
                      do {
                          node = node.previousSibling;
                      } while (node && node.className === HIGHLIGHT_CLASSNAME);
          Severity: Major
          Found in src/LiveDevelopment/Agents/RemoteFunctions.js - About 2 hrs to fix

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

                          } else {
                            elStyling['height'] = elementStyling.getPropertyValue('padding-' + side);  
                            elStyling['width'] = innerWidth + "px";
                            elStyling['left'] = 0;
                              
            Severity: Major
            Found in src/LiveDevelopment/Agents/RemoteFunctions.js and 1 other location - About 3 hrs to fix
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 323..332

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

            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 (visualisations.horizontal.indexOf(side) >= 0) {
                            elStyling['width'] =  elementStyling.getPropertyValue('padding-' + side);
                            elStyling['height'] = innerHeight + "px";
                            elStyling['top'] = 0;
                              
            Severity: Major
            Found in src/LiveDevelopment/Agents/RemoteFunctions.js and 1 other location - About 3 hrs to fix
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 332..340

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

            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

                            if (targetElement.remove) {
                                targetElement.remove();
                            } else if (targetElement.parentNode && targetElement.parentNode.removeChild) {
                                targetElement.parentNode.removeChild(targetElement);
                            }
            Severity: Major
            Found in src/LiveDevelopment/Agents/RemoteFunctions.js and 2 other locations - About 1 hr to fix
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 858..862
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 900..904

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

            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

                            if (current.remove) {
                                current.remove();
                            } else if (current.parentNode && current.parentNode.removeChild) {
                                current.parentNode.removeChild(current);
                            }
            Severity: Major
            Found in src/LiveDevelopment/Agents/RemoteFunctions.js and 2 other locations - About 1 hr to fix
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 900..904
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 926..930

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

            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

                                if (node.remove) {
                                    node.remove();
                                } else if (node.parentNode && node.parentNode.removeChild) {
                                    node.parentNode.removeChild(node);
                                }
            Severity: Major
            Found in src/LiveDevelopment/Agents/RemoteFunctions.js and 2 other locations - About 1 hr to fix
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 858..862
            src/LiveDevelopment/Agents/RemoteFunctions.js on lines 926..930

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

            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