lib/network/modules/LayoutEngine.js

Summary

Maintainability
F
2 wks
Test Coverage

Function _condenseHierarchy has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring.
Open

  _condenseHierarchy() {
    // Global var in this scope to define when the movement has stopped.
    let stillShifting = false;
    let branches = {};
    // first we have some methods to help shifting trees around.
Severity: Minor
Found in lib/network/modules/LayoutEngine.js - About 2 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

File LayoutEngine.js has 1087 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
/**
 * There's a mix-up with terms in the code. Following are the formal definitions:
 *
 *   tree   - a strict hierarchical network, i.e. every node has at most one parent
Severity: Major
Found in lib/network/modules/LayoutEngine.js - About 2 days to fix

    Function _condenseHierarchy has 268 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _condenseHierarchy() {
        // Global var in this scope to define when the movement has stopped.
        let stillShifting = false;
        let branches = {};
        // first we have some methods to help shifting trees around.
    Severity: Major
    Found in lib/network/modules/LayoutEngine.js - About 1 day to fix

      Function adaptAllOptionsForHierarchicalLayout has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
      Open

        adaptAllOptionsForHierarchicalLayout(allOptions) {
          if (this.options.hierarchical.enabled === true) {
            let backupPhysics = this.optionsBackup.physics;
      
            // set the physics
      Severity: Minor
      Found in lib/network/modules/LayoutEngine.js - About 1 day 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 layoutNetwork has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

        layoutNetwork() {
          if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) {
            let indices = this.body.nodeIndices;
      
            // first check if we should Kamada Kawai to layout. The threshold is if less than half of the visible
      Severity: Minor
      Found in lib/network/modules/LayoutEngine.js - About 5 hrs 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 setupHierarchicalLayout has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

        setupHierarchicalLayout() {
          if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) {
            // get the size of the largest hubs and check if the user has defined a level for a node.
            let node, nodeId;
            let definedLevel = false;
      Severity: Minor
      Found in lib/network/modules/LayoutEngine.js - About 4 hrs 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 _crawlNetwork has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

        _crawlNetwork(callback = function() {}, startingNodeId) {
          let progress = {};
      
          let crawler = (node, tree) => {
            if (progress[node.id] === undefined) {
      Severity: Minor
      Found in lib/network/modules/LayoutEngine.js - About 4 hrs 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 minimizeEdgeLength has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          let minimizeEdgeLength = (iterations, node) => {
            //window.CALLBACKS.push(() => {
            //  console.log("ts",node.id);
              let nodeId = node.id;
              let allEdges = node.edges;
      Severity: Major
      Found in lib/network/modules/LayoutEngine.js - About 3 hrs to fix

        LayoutEngine has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class LayoutEngine {
          /**
           * @param {Object} body
           */
          constructor(body) {
        Severity: Minor
        Found in lib/network/modules/LayoutEngine.js - About 3 hrs to fix

          Function setOptions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            setOptions(options, allOptions) {
              if (options !== undefined) {
                let hierarchical = this.options.hierarchical;
                let prevHierarchicalState = hierarchical.enabled;
                util.selectiveDeepExtend(["randomSeed", "improvedLayout"],this.options, options);
          Severity: Minor
          Found in lib/network/modules/LayoutEngine.js - About 3 hrs 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 layoutNetwork has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            layoutNetwork() {
              if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) {
                let indices = this.body.nodeIndices;
          
                // first check if we should Kamada Kawai to layout. The threshold is if less than half of the visible
          Severity: Major
          Found in lib/network/modules/LayoutEngine.js - About 2 hrs to fix

            Function _findCommonParent has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              _findCommonParent(childA,childB) {
                let parents = {};
                let iterateParents = (parents,child) => {
                  let parentRef =  this.hierarchical.parentReference[child];
                  if (parentRef !== undefined) {
            Severity: Minor
            Found in lib/network/modules/LayoutEngine.js - About 2 hrs 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 adaptAllOptionsForHierarchicalLayout has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              adaptAllOptionsForHierarchicalLayout(allOptions) {
                if (this.options.hierarchical.enabled === true) {
                  let backupPhysics = this.optionsBackup.physics;
            
                  // set the physics
            Severity: Major
            Found in lib/network/modules/LayoutEngine.js - About 2 hrs to fix

              Function _getSpaceAroundNode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                _getSpaceAroundNode(node, map) {
                  let useMap = true;
                  if (map === undefined) {
                    useMap = false;
                  }
              Severity: Minor
              Found in lib/network/modules/LayoutEngine.js - About 2 hrs 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 _placeNodesByHierarchy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                _placeNodesByHierarchy(distribution) {
                  this.positionedNodes = {};
                  // start placing all the level 0 nodes first. Then recursively position their branches.
                  for (let level in distribution) {
                    if (distribution.hasOwnProperty(level)) {
              Severity: Minor
              Found in lib/network/modules/LayoutEngine.js - About 1 hr 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 setupHierarchicalLayout has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                setupHierarchicalLayout() {
                  if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) {
                    // get the size of the largest hubs and check if the user has defined a level for a node.
                    let node, nodeId;
                    let definedLevel = false;
              Severity: Minor
              Found in lib/network/modules/LayoutEngine.js - About 1 hr to fix

                Function _crawlNetwork has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _crawlNetwork(callback = function() {}, startingNodeId) {
                    let progress = {};
                
                    let crawler = (node, tree) => {
                      if (progress[node.id] === undefined) {
                Severity: Minor
                Found in lib/network/modules/LayoutEngine.js - About 1 hr to fix

                  Function _centerParent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _centerParent(node) {
                      if (this.hierarchical.parentReference[node.id]) {
                        let parents = this.hierarchical.parentReference[node.id];
                        for (var i = 0; i < parents.length; i++) {
                          let parentId = parents[i];
                  Severity: Minor
                  Found in lib/network/modules/LayoutEngine.js - About 1 hr 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 setMinLevelToZero has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    setMinLevelToZero(nodes) {
                      let minLevel = 1e9;
                      // get the minimum level
                      for (let nodeId in nodes) {
                        if (nodes.hasOwnProperty(nodeId)) {
                  Severity: Minor
                  Found in lib/network/modules/LayoutEngine.js - About 1 hr 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 setOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    setOptions(options, allOptions) {
                      if (options !== undefined) {
                        let hierarchical = this.options.hierarchical;
                        let prevHierarchicalState = hierarchical.enabled;
                        util.selectiveDeepExtend(["randomSeed", "improvedLayout"],this.options, options);
                  Severity: Minor
                  Found in lib/network/modules/LayoutEngine.js - About 1 hr to fix

                    Function getMaxLevel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      getMaxLevel(nodeId) {
                        let accumulator = {};
                    
                        let _getMaxLevel = (nodeId) => {
                          if (accumulator[nodeId] !== undefined) {
                    Severity: Minor
                    Found in lib/network/modules/LayoutEngine.js - About 1 hr 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 _getSpaceAroundNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _getSpaceAroundNode(node, map) {
                        let useMap = true;
                        if (map === undefined) {
                          useMap = false;
                        }
                    Severity: Minor
                    Found in lib/network/modules/LayoutEngine.js - About 1 hr to fix

                      Function branchShiftCallback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          let branchShiftCallback = (node1, node2, centerParent = false) => {
                            //window.CALLBACKS.push(() => {
                              let pos1 = this.direction.getPosition(node1);
                              let pos2 = this.direction.getPosition(node2);
                              let diffAbs = Math.abs(pos2 - pos1);
                      Severity: Minor
                      Found in lib/network/modules/LayoutEngine.js - About 1 hr to fix

                        Function _placeBranchNodes has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _placeBranchNodes(parentId, parentLevel) {
                            let childRef = this.hierarchical.childrenReference[parentId];
                        
                            // if this is not a parent, cancel the placing. This can happen with multiple parents to one child.
                            if (childRef === undefined) {
                        Severity: Minor
                        Found in lib/network/modules/LayoutEngine.js - About 1 hr to fix

                          Function _findCommonParent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            _findCommonParent(childA,childB) {
                              let parents = {};
                              let iterateParents = (parents,child) => {
                                let parentRef =  this.hierarchical.parentReference[child];
                                if (parentRef !== undefined) {
                          Severity: Minor
                          Found in lib/network/modules/LayoutEngine.js - About 1 hr to fix

                            Function _placeBranchNodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              _placeBranchNodes(parentId, parentLevel) {
                                let childRef = this.hierarchical.childrenReference[parentId];
                            
                                // if this is not a parent, cancel the placing. This can happen with multiple parents to one child.
                                if (childRef === undefined) {
                            Severity: Minor
                            Found in lib/network/modules/LayoutEngine.js - About 1 hr 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 _determineLevelsDirected has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              _determineLevelsDirected() {
                                let minLevel = 10000;
                            
                                /**
                                 * Check if there is an edge going the opposite direction for given edge
                            Severity: Minor
                            Found in lib/network/modules/LayoutEngine.js - About 1 hr 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 _getDistribution has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              _getDistribution() {
                                let distribution = {};
                                let nodeId, node;
                            
                                // we fix Y because the hierarchy is vertical,
                            Severity: Minor
                            Found in lib/network/modules/LayoutEngine.js - About 55 mins 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 positionInitially has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              positionInitially(nodesArray) {
                                if (this.options.hierarchical.enabled !== true) {
                                  this.randomSeed = this.initialRandomSeed;
                                  let radius = nodesArray.length + 50;
                                  for (let i = 0; i < nodesArray.length; i++) {
                            Severity: Minor
                            Found in lib/network/modules/LayoutEngine.js - About 55 mins 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

                            Avoid deeply nested control flow statements.
                            Open

                                        if (handledNodeCount > 0) {
                                          pos = this.direction.getPosition(nodeArray[i-1]) + spacing;
                                        }
                            Severity: Major
                            Found in lib/network/modules/LayoutEngine.js - About 45 mins to fix

                              Function hasSameParent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                hasSameParent(node1, node2) {
                                  let parents1 = this.parentReference[node1.id];
                                  let parents2 = this.parentReference[node2.id];
                                  if (parents1 === undefined || parents2 === undefined) {
                                    return false;
                              Severity: Minor
                              Found in lib/network/modules/LayoutEngine.js - About 45 mins 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

                              Avoid deeply nested control flow statements.
                              Open

                                          if (level % 3 === 0) {
                                            this.body.modules.clustering.clusterBridges(clusterOptions);
                                          }
                                          else {
                                            this.body.modules.clustering.clusterOutliers(clusterOptions);
                              Severity: Major
                              Found in lib/network/modules/LayoutEngine.js - About 45 mins to fix

                                Function _declusterAll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  _declusterAll() {
                                    let clustersPresent = true;
                                    while (clustersPresent === true) {
                                      clustersPresent = false;
                                      for (let i = 0; i < this.body.nodeIndices.length; i++) {
                                Severity: Minor
                                Found in lib/network/modules/LayoutEngine.js - About 45 mins 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

                                Avoid deeply nested control flow statements.
                                Open

                                            if (before == after && level % 3 !== 0) {
                                              this._declusterAll();
                                              this.body.emitter.emit("_layoutFailed");
                                              console.info("This network could not be positioned by this version of the improved layout algorithm."
                                                        +  " Please disable improvedLayout for better performance.");
                                Severity: Major
                                Found in lib/network/modules/LayoutEngine.js - About 45 mins to fix

                                  Function _shiftBlock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    _shiftBlock(parentId, diff) {
                                      let progress = {};
                                      let shifter = (parentId) => {
                                        if (progress[parentId]) {
                                          return;
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js - About 35 mins 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 getTreeSize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    getTreeSize(nodes, index) {
                                      let min_x = 1e9;
                                      let max_x = -1e9;
                                      let min_y = 1e9;
                                      let max_y = -1e9;
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js - About 25 mins 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

                                  TODO found
                                  Open

                                          let clusterThreshold = 150;  // TODO add this to options
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  TODO found
                                  Open

                                     * TODO: Determine if this feature is needed at all
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  TODO found
                                  Open

                                      // TODO: this should come from options.
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  TODO found
                                  Open

                                     * TODO: Never entered; find a test case to test this!
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  TODO found
                                  Open

                                            // TODO: this is options merging; see if the standard routines can be used here.
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  TODO found
                                  Open

                                          // TODO: examine why this is so
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  TODO found
                                  Open

                                     * TODO: release feature
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  TODO found
                                  Open

                                      // TODO: perhaps move to HierarchicalStatus.
                                  Severity: Minor
                                  Found in lib/network/modules/LayoutEngine.js by fixme

                                  There are no issues that match your filters.

                                  Category
                                  Status