lib/timeline/component/item/BoxItem.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function repositionX has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

BoxItem.prototype.repositionX = function() {
  var start = this.conversion.toScreen(this.data.start);
  var align = this.options.align;

  // calculate left position of the box
Severity: Minor
Found in lib/timeline/component/item/BoxItem.js - About 1 hr to fix

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

    BoxItem.prototype.repositionX = function() {
      var start = this.conversion.toScreen(this.data.start);
      var align = this.options.align;
    
      // calculate left position of the box
    Severity: Minor
    Found in lib/timeline/component/item/BoxItem.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 _appendDomElement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    BoxItem.prototype._appendDomElement = function() {
      if (!this.parent) {
        throw new Error('Cannot redraw item: no parent attached');
      }
      if (!this.dom.box.parentNode) {
    Severity: Minor
    Found in lib/timeline/component/item/BoxItem.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 redraw has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

      BoxItem.prototype._updateDirtyDomComponents = function() {
        // 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/BoxItem.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 hide has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      BoxItem.prototype.hide = function() {
        if (this.displayed) {
          var dom = this.dom;
      
          if (dom.box.parentNode)   dom.box.parentNode.removeChild(dom.box);
      Severity: Minor
      Found in lib/timeline/component/item/BoxItem.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

      TODO found
      Open

          var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty

      TODO found
      Open

       *                                  // TODO: describe available options

      There are no issues that match your filters.

      Category
      Status