Showing 835 of 1,558 total issues

Function DOTToGraph has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function DOTToGraph (data) {
  // parse the DOT file
  var dotData = parseDOT(data);
  var graphData = {
    nodes: [],
Severity: Major
Found in lib/network/dotparser.js - About 2 hrs to fix

    Function selectiveNotDeepExtend has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.selectiveNotDeepExtend = function (propsToExclude, a, b, allowDeletion = false) {
      // TODO: add support for Arrays to deepExtend
      // NOTE: array properties have an else-below; apparently, there is a problem here. 
      if (Array.isArray(b)) {
        throw new TypeError('Arrays are not supported by deepExtend');
    Severity: Minor
    Found in lib/util.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 _updateValueRange has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    Network.prototype._updateValueRange = function (obj) {
      var id;
    
      // determine the range of the objects
      var valueMin = undefined;
    Severity: Minor
    Found in lib/network/Network.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 _formBarnesHutTree has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      _formBarnesHutTree(nodes, nodeIndices) {
        let node;
        let nodeCount = nodeIndices.length;
    
        let minX = nodes[nodeIndices[0]].x;
    Severity: Minor
    Found in lib/network/modules/components/physics/BarnesHutSolver.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 fit has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      fit(options = {nodes:[]}, initialZoom = false) {
        let range;
        let zoomLevel;
        if (options.nodes === undefined || options.nodes.length === 0) {
          options.nodes = this.body.nodeIndices;
    Severity: Minor
    Found in lib/network/modules/View.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 setColor has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      setColor(color, setInitial = true) {
        if (color === 'none') {
          return;
        }
    
    
    Severity: Minor
    Found in lib/shared/ColorPicker.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 getItemRange has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Timeline.prototype.getItemRange = function () {
      // get a rough approximation for the range based on the items start and end dates
      var range = this.getDataRange();
      var min = range.min !== null ? range.min.valueOf() : null;
      var max = range.max !== null ? range.max.valueOf() : null;
    Severity: Major
    Found in lib/timeline/Timeline.js - About 2 hrs to fix

      Function _onEvent has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      DataView.prototype._onEvent = function (event, params, senderId) {
        var i, len, id, item;
        var ids = params && params.items;
        var addedIds = [],
            updatedIds = [],
      Severity: Major
      Found in lib/DataView.js - About 2 hrs to fix

        Function parseColor has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.parseColor = function (color) {
          var c;
          if (exports.isString(color) === true) {
            if (exports.isValidRGB(color) === true) {
              var rgb = color.substr(4).substr(0, color.length - 5).split(',').map(function (value) { return parseInt(value) });
        Severity: Major
        Found in lib/util.js - About 2 hrs to fix

          Function mergeOptions has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.mergeOptions = function (mergeTarget, options, option, globalOptions = {}) {
            // Local helpers
            var isPresent = function(obj) {
              return obj !== null && obj !== undefined;
            }
          Severity: Major
          Found in lib/util.js - About 2 hrs to fix

            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 solve has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                solve() {
                  var edgeLength, edge;
                  var dx, dy, fx, fy, springForce, distance;
                  var edges = this.body.edges;
                  var factor = 0.5;
              Severity: Major
              Found in lib/network/modules/components/physics/HierarchicalSpringSolver.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                  if (this.touchParams.itemProps) {
                    event.stopPropagation();
                
                    var me = this;
                    var snap = this.options.snap || null;
                Severity: Critical
                Found in lib/timeline/component/ItemSet.js - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                        if ((((this.edgeType instanceof BezierEdgeDynamic) &&
                              (smooth.enabled === true) &&
                              (smooth.type === 'dynamic'))) ||
                            (((this.edgeType instanceof CubicBezierEdge) &&
                              (smooth.enabled === true) &&
                  Severity: Critical
                  Found in lib/network/modules/components/Edge.js - About 2 hrs to fix

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

                     _checkShowPopup(pointer) {
                        let x = this.canvas._XconvertDOMtoCanvas(pointer.x);
                        let y = this.canvas._YconvertDOMtoCanvas(pointer.y);
                        let pointerObj = {
                          left:   x,
                    Severity: Major
                    Found in lib/network/modules/InteractionHandler.js - About 2 hrs to fix

                      Function initializeData has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      DataGroup.prototype.initializeData = function(graph3d, rawData, style) {
                        if (rawData === undefined) return;
                      
                        if (Array.isArray(rawData)) {
                          rawData = new DataSet(rawData);
                      Severity: Major
                      Found in lib/graph3d/DataGroup.js - About 2 hrs to fix

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

                        GraphGroup.prototype.setOptions = function (options) {
                          if (options !== undefined) {
                            var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'zIndex','excludeFromStacking', 'excludeFromLegend'];
                            util.selectiveDeepExtend(fields, this.options, options);
                        
                        
                        Severity: Minor
                        Found in lib/timeline/component/GraphGroup.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

                        File Canvas.js has 274 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/network/modules/Canvas.js - About 2 hrs to fix

                          Function focus has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Timeline.prototype.focus = function(id, options) {
                            if (!this.itemsData || id == undefined) return;
                          
                            var ids = Array.isArray(id) ? id : [id];
                          
                          
                          Severity: Major
                          Found in lib/timeline/Timeline.js - About 2 hrs to fix

                            Function DataAxis has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function DataAxis(body, options, svg, linegraphOptions) {
                              this.id = util.randomUUID();
                              this.body = body;
                            
                              this.defaultOptions = {
                            Severity: Major
                            Found in lib/timeline/component/DataAxis.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language