Showing 1,558 of 1,558 total issues

File Network.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Load custom shapes into CanvasRenderingContext2D
require('./shapes');

let Emitter = require('emitter-component');
let util = require('../util');
Severity: Minor
Found in lib/network/Network.js - About 4 hrs to fix

    Function updateHiddenDates has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.updateHiddenDates = function (moment, body, hiddenDates) {
      if (hiddenDates && !Array.isArray(hiddenDates)) {
        return exports.updateHiddenDates(moment, body, [hiddenDates])
      }
    
    
    Severity: Major
    Found in lib/timeline/DateUtil.js - About 4 hrs to fix

      File ColorPicker.js has 360 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      let Hammer = require('../module/hammer');
      let hammerUtil = require('../hammerUtil');
      let util = require('../util');
      
      /**
      Severity: Minor
      Found in lib/shared/ColorPicker.js - About 4 hrs to fix

        Function _updateState has 115 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _updateState() {
            let nodeId;
            let deletedNodeIds = [];
            let deletedEdgeIds = [];
        
        
        Severity: Major
        Found in lib/network/modules/Clustering.js - About 4 hrs to fix

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

          class VerticalStrategy extends DirectionInterface {
            /**
             * Constructor
             *
             * @param {Object} layout reference to the parent LayoutEngine instance.
          Severity: Major
          Found in lib/network/modules/components/DirectionStrategy.js and 1 other location - About 4 hrs to fix
          lib/network/modules/components/DirectionStrategy.js on lines 187..241

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 382.

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

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

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

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

          Refactorings

          Further Reading

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

          class HorizontalStrategy extends DirectionInterface {
            /**
             * Constructor
             *
             * @param {Object} layout reference to the parent LayoutEngine instance.
          Severity: Major
          Found in lib/network/modules/components/DirectionStrategy.js and 1 other location - About 4 hrs to fix
          lib/network/modules/components/DirectionStrategy.js on lines 122..176

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 382.

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

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

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

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

          Refactorings

          Further Reading

          Function stackSubgroupsWithInnerStack has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.stackSubgroupsWithInnerStack = function (subgroupItems, margin, subgroups) {
            var doSubStack = false;
            
            // Run subgroups in their order (if any)
            var subgroupOrder = [];
          Severity: Minor
          Found in lib/timeline/Stack.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 _repaintLabels has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          TimeAxis.prototype._repaintLabels = function () {
            var orientation = this.options.orientation.axis;
          
            // calculate range and step (step such that we have space for 7 characters per label)
            var start = util.convert(this.body.range.start, 'Number');
          Severity: Minor
          Found in lib/timeline/component/TimeAxis.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 mergeOptions has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.mergeOptions = function (mergeTarget, options, option, globalOptions = {}) {
            // Local helpers
            var isPresent = function(obj) {
              return obj !== null && obj !== undefined;
            }
          Severity: Minor
          Found in lib/util.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 setOptions has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

            setOptions(options) {
              if (options !== undefined) {
                Node.parseOptions(this.options, options);
          
                // update the shape in all nodes
          Severity: Minor
          Found in lib/network/modules/NodesHandler.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 _createClusterEdges has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

            _createClusterEdges (childNodesObj, childEdgesObj, clusterNodeProperties, clusterEdgeProperties) {
              let edge, childNodeId, childNode, toId, fromId, otherNodeId;
          
              // loop over all child nodes and their edges to find edges going out of the cluster
              // these edges will be replaced by clusterEdges.
          Severity: Minor
          Found in lib/network/modules/Clustering.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 getFormattingValues has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

            getFormattingValues() {
              let toArrow = (this.options.arrows.to === true) || (this.options.arrows.to.enabled === true)
              let fromArrow = (this.options.arrows.from === true) || (this.options.arrows.from.enabled === true)
              let middleArrow = (this.options.arrows.middle === true) || (this.options.arrows.middle.enabled === true)
              let inheritsColor = this.options.color.inherit;
          Severity: Minor
          Found in lib/network/modules/components/Edge.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 splitMarkdownBlocks has 113 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            splitMarkdownBlocks(text) {
              let blocks = [];
          
              // TODO: consolidate following + methods/closures with splitHtmlBlocks()
              // NOTE: sequences of tabs and spaces are reduced to single space; scan usage of `this.spacing` within method
          Severity: Major
          Found in lib/network/modules/components/shared/LabelSplitter.js - About 4 hrs to fix

            Function setMinimumStep has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

            TimeStep.prototype.setMinimumStep = function(minimumStep) {
              if (minimumStep == undefined) {
                return;
              }
            
            
            Severity: Minor
            Found in lib/timeline/TimeStep.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 followScale has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

            DataScale.prototype.followScale = function (other) {
              var oldStepIdx = this.minorStepIdx;
              var oldStart = this._start;
              var oldEnd = this._end;
            
            
            Severity: Minor
            Found in lib/timeline/component/DataScale.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 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 _onDrag has 110 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ItemSet.prototype._onDrag = function (event) {
              if (this.touchParams.itemProps) {
                event.stopPropagation();
            
                var me = this;
            Severity: Major
            Found in lib/timeline/component/ItemSet.js - About 4 hrs to fix

              Function splitHtmlBlocks has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                splitHtmlBlocks(text) {
                  let blocks = [];
              
                  // TODO: consolidate following + methods/closures with splitMarkdownBlocks()
                  // NOTE: sequences of tabs and spaces are reduced to single space; scan usage of `this.spacing` within method
              Severity: Major
              Found in lib/network/modules/components/shared/LabelSplitter.js - About 4 hrs to fix

                Function getToken has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getToken() {
                  tokenType = TOKENTYPE.NULL;
                  token = '';
                
                  // skip over whitespaces
                Severity: Major
                Found in lib/network/dotparser.js - About 4 hrs to fix

                  Function _getStackedYRange has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Bargraph._getStackedYRange = function (intersections, combinedData) {
                    var key;
                    var yMin = combinedData[0].screen_y;
                    var yMax = combinedData[0].screen_y;
                    for (var i = 0; i < combinedData.length; i++) {
                  Severity: Minor
                  Found in lib/timeline/component/graph2d_types/bar.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

                  Severity
                  Category
                  Status
                  Source
                  Language