lib/timeline/component/item/RangeItem.js

Summary

Maintainability
D
1 day
Test Coverage

Function repositionX has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

RangeItem.prototype.repositionX = function(limitSize) {
  var parentWidth = this.parent.width;
  var start = this.conversion.toScreen(this.data.start);
  var end = this.conversion.toScreen(this.data.end);
  var align = this.data.align === undefined ? this.options.align : this.data.align;
Severity: Minor
Found in lib/timeline/component/item/RangeItem.js - About 6 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 repositionX has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

RangeItem.prototype.repositionX = function(limitSize) {
  var parentWidth = this.parent.width;
  var start = this.conversion.toScreen(this.data.start);
  var end = this.conversion.toScreen(this.data.end);
  var align = this.data.align === undefined ? this.options.align : this.data.align;
Severity: Major
Found in lib/timeline/component/item/RangeItem.js - About 3 hrs to fix

    File RangeItem.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var Item = require('./Item');
    
    /**
     * @constructor RangeItem
     * @extends Item
    Severity: Minor
    Found in lib/timeline/component/item/RangeItem.js - About 2 hrs to fix

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

      RangeItem.prototype.redraw = function(returnQueue) {
        var sizes;
        var queue = [
          // create item DOM
          this._createDomElement.bind(this),
      Severity: Minor
      Found in lib/timeline/component/item/RangeItem.js - About 1 hr to fix

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

        RangeItem.prototype._updateDirtyDomComponents = function() {
          // update dirty DOM. An item is marked dirty when:
          // - the item is not yet rendered
          // - the item's data is changed
          // - the item is selected/deselected
        Severity: Minor
        Found in lib/timeline/component/item/RangeItem.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

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

        RangeItem.prototype._repaintDragLeft = function () {
          if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.options.editable.updateTime && !this.dom.dragLeft) {
            // create and show drag area
            var dragLeft = document.createElement('div');
            dragLeft.className = 'vis-drag-left';
        Severity: Minor
        Found in lib/timeline/component/item/RangeItem.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 _repaintDragRight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        RangeItem.prototype._repaintDragRight = function () {
          if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.options.editable.updateTime && !this.dom.dragRight) {
            // create and show drag area
            var dragRight = document.createElement('div');
            dragRight.className = 'vis-drag-right';
        Severity: Minor
        Found in lib/timeline/component/item/RangeItem.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

         *                                  // TODO: describe options

        There are no issues that match your filters.

        Category
        Status