juanmard/icestudio

View on GitHub
services/graph.js

Summary

Maintainability
F
2 wks
Test Coverage

File graph.js has 1482 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable new-cap */

angular
  .module('icestudio')
  .service(
Severity: Major
Found in services/graph.js - About 3 days to fix

    Function createPaper has 542 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          this.createPaper = function (element) {
            graph = new joint.dia.Graph();
    
            paper = new joint.dia.Paper({
              el: element,
    Severity: Major
    Found in services/graph.js - About 2 days to fix

      Function graphToCells has 161 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function graphToCells(_graph, opt) {
              // Options:
              // - new: assign a new id to all the cells
              // - reset: clear I/O blocks values
              // - disabled: set disabled flag to the blocks
      Severity: Major
      Found in services/graph.js - About 6 hrs to fix

        Function validateConnection has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  validateConnection: function (
                    cellViewS,
                    magnetS,
                    cellViewT,
                    magnetT,
        Severity: Major
        Found in services/graph.js - About 3 hrs to fix

          Function replaceBlock has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function replaceBlock(upperBlock, lowerBlock) {
                    if (lowerBlock) {
                      // 1. Compute portsMap between the upperBlock and the lowerBlock
                      var portsMap = computeAllPortsMap(upperBlock, lowerBlock);
                      // 2. Reconnect the wires from the lowerBlock to the upperBlock
          Severity: Major
          Found in services/graph.js - About 2 hrs to fix

            Function resetBlocks has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  function resetBlocks() {
                    var data, connectedLinks;
                    var cells = graph.getCells();
                    _.each(cells, function (cell) {
                      if (cell.isLink()) {
            Severity: Major
            Found in services/graph.js - About 2 hrs to fix

              Function appEnable has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    this.appEnable = function (value) {
                      paper.options.enabled = value;
                      var ael, i;
                      if (value) {
                        /* In the new javascript context of nwjs, angular can't change classes over the dom in this way,
              Severity: Minor
              Found in services/graph.js - About 1 hr to fix

                Function fitContent has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      this.fitContent = function () {
                        if (!this.isEmpty()) {
                          // Target box
                          var margin = 40;
                          var menuFooterHeight = 93;
                Severity: Minor
                Found in services/graph.js - About 1 hr to fix

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

                        this.appendDesign = function (design, dependencies) {
                          if (
                            design &&
                            dependencies &&
                            design.graph &&
                  Severity: Minor
                  Found in services/graph.js - About 1 hr to fix

                    Function pasteAndCloneSelected has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          this.pasteAndCloneSelected = function () {
                            if (
                              document.activeElement.tagName === 'A' ||
                              document.activeElement.tagName === 'BODY'
                            ) {
                    Severity: Minor
                    Found in services/graph.js - About 1 hr to fix

                      Function addDraggableCells has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            this.addDraggableCells = function (cells) {
                              this.addingDraggableBlock = true;
                              var menuHeight = $('#menu').height();
                              if (cells.length > 0) {
                                var firstCell = cells[0];
                      Severity: Minor
                      Found in services/graph.js - About 1 hr to fix

                        Function findLowerBlock has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function findLowerBlock(upperBlock) {
                                  if (
                                    upperBlock.get('type') === 'ice.Wire' ||
                                    upperBlock.get('type') === 'ice.Info'
                                  ) {
                        Severity: Minor
                        Found in services/graph.js - About 1 hr to fix

                          Function loadDesign has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                this.loadDesign = function (design, opt, callback) {
                                  if (
                                    design &&
                                    design.graph &&
                                    design.graph.blocks &&
                          Severity: Minor
                          Found in services/graph.js - About 1 hr to fix

                            Function addDraggableCell has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  this.addDraggableCell = function (cell) {
                                    this.addingDraggableBlock = true;
                                    var menuHeight = $('#menu').height();
                                    cell.set('position', {
                                      x:
                            Severity: Minor
                            Found in services/graph.js - About 1 hr to fix

                              Function computePortsMap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      function computePortsMap(upperBlock, lowerBlock, portType) {
                                        var portsMap = {};
                                        var usedUpperPorts = [];
                                        var upperPorts = upperBlock.get(portType);
                                        var lowerPorts = lowerBlock.get(portType);
                              Severity: Minor
                              Found in services/graph.js - About 1 hr to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                  if (port.name === target.port && port.default) {
                                                    port.default.apply = value;
                                                    break;
                                                  }
                                Severity: Major
                                Found in services/graph.js - About 45 mins to fix

                                  Function validateConnection has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                              cellViewS,
                                              magnetS,
                                              cellViewT,
                                              magnetT,
                                              end,
                                  Severity: Minor
                                  Found in services/graph.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if (connectedLink.get('target').port === item.id) {
                                                          connected = true;
                                                          return false;
                                                        }
                                    Severity: Major
                                    Found in services/graph.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                        for (var opin = 0; opin < opt.designPinout.length; opin++) {
                                                          if (
                                                            String(opt.designPinout[opin].name) ===
                                                            String(pins[i].name)
                                                          ) {
                                      Severity: Major
                                      Found in services/graph.js - About 45 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                        return false;
                                        Severity: Major
                                        Found in services/graph.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                        return false;
                                          Severity: Major
                                          Found in services/graph.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                      return lowerBlock;
                                            Severity: Major
                                            Found in services/graph.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                              return false;
                                              Severity: Major
                                              Found in services/graph.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                              return ret;
                                                Severity: Major
                                                Found in services/graph.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return magnetS !== magnetT;
                                                  Severity: Major
                                                  Found in services/graph.js - About 30 mins to fix

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

                                                              if (!cell.isLink()) {
                                                                var cellView = paper.findViewByModel(cell);
                                                                if (cellView.$box.css('z-index') < z.index) {
                                                                  cellView.$box.css('z-index', ++z.index);
                                                                }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 2 hrs to fix
                                                    services/graph.js on lines 1637..1642

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

                                                    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

                                                              if (!cell.isLink()) {
                                                                var cellView = paper.findViewByModel(cell);
                                                                if (cellView.$box.css('z-index') < z.index) {
                                                                  cellView.$box.css('z-index', ++z.index);
                                                                }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 2 hrs to fix
                                                    services/graph.js on lines 1652..1657

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

                                                    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

                                                                if (!cellView.model.isLink()) {
                                                                  if (cellView.$box.css('z-index') < z.index) {
                                                                    cellView.$box.css('z-index', ++z.index);
                                                                  }
                                                                }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 369..373

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

                                                    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 (typeof ael !== 'undefined' && ael.length > 0) {
                                                                for (i = 0; i < ael.length; i++) {
                                                                  ael[i].classList.add('looks-disabled');
                                                                }
                                                              }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 865..869

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

                                                    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

                                                                  if (!cellView.model.isLink()) {
                                                                    if (cellView.$box.css('z-index') < z.index) {
                                                                      cellView.$box.css('z-index', ++z.index);
                                                                    }
                                                                  }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 508..512

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

                                                    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 (typeof ael !== 'undefined' && ael.length > 0) {
                                                                for (i = 0; i < ael.length; i++) {
                                                                  ael[i].classList.remove('looks-disabled');
                                                                }
                                                              }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 878..882

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

                                                    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

                                                                Math.round(
                                                                  ((mousePosition.y - state.pan.y - menuHeight) / state.zoom -
                                                                    cell.get('size').height / 2) /
                                                                    gridsize
                                                                ) * gridsize,
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 961..966

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

                                                    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

                                                                  Math.round(
                                                                    ((mousePosition.y - state.pan.y - menuHeight) / state.zoom -
                                                                      firstCell.get('size').height / 2) /
                                                                      gridsize
                                                                  ) *
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 928..932

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

                                                    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

                                                                  Math.round(
                                                                    ((mousePosition.x - state.pan.x) / state.zoom -
                                                                      firstCell.get('size').width / 2) /
                                                                      gridsize
                                                                  ) *
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 922..926

                                                    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

                                                                Math.round(
                                                                  ((mousePosition.x - state.pan.x) / state.zoom -
                                                                    cell.get('size').width / 2) /
                                                                    gridsize
                                                                ) * gridsize,
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 953..958

                                                    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

                                                                    _.each(connectedLinks, function (connectedLink) {
                                                                      if (connectedLink.get('target').port === port.name) {
                                                                        connected = true;
                                                                        return false;
                                                                      }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 1117..1122

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

                                                    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

                                                                      _.each(connectedLinks, function (connectedLink) {
                                                                        if (connectedLink.get('target').port === item.id) {
                                                                          connected = true;
                                                                          return false;
                                                                        }
                                                    Severity: Major
                                                    Found in services/graph.js and 1 other location - About 1 hr to fix
                                                    services/graph.js on lines 1097..1102

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

                                                    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 (prevLowerBlock) {
                                                                // Unhighlight previous lower block
                                                                var prevLowerBlockView = paper.findViewByModel(prevLowerBlock);
                                                                prevLowerBlockView.$box.removeClass('block-disabled');
                                                                prevLowerBlockView.$el.removeClass('block-disabled');
                                                    Severity: Minor
                                                    Found in services/graph.js and 1 other location - About 55 mins to fix
                                                    services/graph.js on lines 738..743

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

                                                    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 (lowerBlock) {
                                                                // Highlight new lower block
                                                                var lowerBlockView = paper.findViewByModel(lowerBlock);
                                                                lowerBlockView.$box.addClass('block-disabled');
                                                                lowerBlockView.$el.addClass('block-disabled');
                                                    Severity: Minor
                                                    Found in services/graph.js and 1 other location - About 55 mins to fix
                                                    services/graph.js on lines 732..737

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

                                                    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

                                                          this.undo = function () {
                                                            if (!this.addingDraggableBlock) {
                                                              disableSelected();
                                                              commandManager.undo();
                                                              updateWiresOnObstacles();
                                                    Severity: Minor
                                                    Found in services/graph.js and 1 other location - About 50 mins to fix
                                                    services/graph.js on lines 837..843

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

                                                    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

                                                          this.redo = function () {
                                                            if (!this.addingDraggableBlock) {
                                                              disableSelected();
                                                              commandManager.redo();
                                                              updateWiresOnObstacles();
                                                    Severity: Minor
                                                    Found in services/graph.js and 1 other location - About 50 mins to fix
                                                    services/graph.js on lines 829..835

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

                                                    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

                                                              var target = {
                                                                x: tbox.x + tbox.width / 2,
                                                                y: tbox.y + tbox.height / 2,
                                                              };
                                                    Severity: Minor
                                                    Found in services/graph.js and 1 other location - About 45 mins to fix
                                                    services/graph.js on lines 124..127

                                                    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

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

                                                              var source = {
                                                                x: sbox.x + sbox.width / 2,
                                                                y: sbox.y + sbox.height / 2,
                                                              };
                                                    Severity: Minor
                                                    Found in services/graph.js and 1 other location - About 45 mins to fix
                                                    services/graph.js on lines 120..123

                                                    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