lib/timeline/Graph2d.js

Summary

Maintainability
D
1 day
Test Coverage

Function getDataRange has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

Graph2d.prototype.getDataRange = function() {
  var min = null;
  var max = null;

  // calculate min from start filed
Severity: Minor
Found in lib/timeline/Graph2d.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 Graph2d has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Graph2d (container, items, groups, options) {
  // if the third element is options, the forth is groups (optionally);
  if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) {
    var forthArgument = options;
    options = groups;
Severity: Major
Found in lib/timeline/Graph2d.js - About 2 hrs to fix

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

    Graph2d.prototype.setItems = function(items) {
      var initialLoad = (this.itemsData == null);
    
      // convert to type DataSet when needed
      var newDataSet;
    Severity: Minor
    Found in lib/timeline/Graph2d.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 getEventProperties has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    Graph2d.prototype.getEventProperties = function (event) {
      var clientX = event.center ? event.center.x : event.clientX;
      var clientY = event.center ? event.center.y : event.clientY;
      var x = clientX - util.getAbsoluteLeft(this.dom.centerContainer);
      var y = clientY - util.getAbsoluteTop(this.dom.centerContainer);
    Severity: Minor
    Found in lib/timeline/Graph2d.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 getEventProperties has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Graph2d.prototype.getEventProperties = function (event) {
      var clientX = event.center ? event.center.x : event.clientX;
      var clientY = event.center ? event.center.y : event.clientY;
      var x = clientX - util.getAbsoluteLeft(this.dom.centerContainer);
      var y = clientY - util.getAbsoluteTop(this.dom.centerContainer);
    Severity: Minor
    Found in lib/timeline/Graph2d.js - About 1 hr to fix

      Function setItems has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Graph2d.prototype.setItems = function(items) {
        var initialLoad = (this.itemsData == null);
      
        // convert to type DataSet when needed
        var newDataSet;
      Severity: Minor
      Found in lib/timeline/Graph2d.js - About 1 hr to fix

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

        function Graph2d (container, items, groups, options) {
          // if the third element is options, the forth is groups (optionally);
          if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) {
            var forthArgument = options;
            options = groups;
        Severity: Minor
        Found in lib/timeline/Graph2d.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

        TODO found
        Open

          // TODO: REMOVE THIS in the next MAJOR release
        Severity: Minor
        Found in lib/timeline/Graph2d.js by fixme

        There are no issues that match your filters.

        Category
        Status