lib/timeline/Core.js

Summary

Maintainability
F
1 wk
Test Coverage

File Core.js has 801 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var Emitter = require('emitter-component');
var Hammer = require('../module/hammer');
var hammerUtil = require('../hammerUtil');
var util = require('../util');
var TimeAxis = require('./component/TimeAxis');
Severity: Major
Found in lib/timeline/Core.js - About 1 day to fix

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

    Core.prototype.setOptions = function (options) {
      if (options) {
        // copy the known options
        var fields = [
          'width', 'height', 'minHeight', 'maxHeight', 'autoResize',
    Severity: Minor
    Found in lib/timeline/Core.js - About 1 day 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 _create has 224 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Core.prototype._create = function (container) {
      this.dom = {};
    
      this.dom.container = container;
    
    
    Severity: Major
    Found in lib/timeline/Core.js - About 1 day to fix

      Function _create has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
      Open

      Core.prototype._create = function (container) {
        this.dom = {};
      
        this.dom.container = container;
      
      
      Severity: Minor
      Found in lib/timeline/Core.js - About 1 day 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 118 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Core.prototype._redraw = function() {
        this.redrawCount++;
        var resized = false;
        var options = this.options;
        var props = this.props;
      Severity: Major
      Found in lib/timeline/Core.js - About 4 hrs to fix

        Function setOptions has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Core.prototype.setOptions = function (options) {
          if (options) {
            // copy the known options
            var fields = [
              'width', 'height', 'minHeight', 'maxHeight', 'autoResize',
        Severity: Major
        Found in lib/timeline/Core.js - About 3 hrs to fix

          Function _redraw has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

          Core.prototype._redraw = function() {
            this.redrawCount++;
            var resized = false;
            var options = this.options;
            var props = this.props;
          Severity: Minor
          Found in lib/timeline/Core.js - About 3 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 onMouseWheel has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function onMouseWheel(event) {
              if (this.isActive()) {
                this.emit('mousewheel', event);
              }
          
          
          Severity: Minor
          Found in lib/timeline/Core.js - About 1 hr to fix

            Function _setDOM has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Core.prototype._setDOM = function () {
              var props = this.props;
              var dom = this.dom;
            
              props.leftContainer.width = props.left.width;
            Severity: Minor
            Found in lib/timeline/Core.js - About 1 hr to fix

              Function setWindow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              Core.prototype.setWindow = function(start, end, options, callback) {
                if (typeof arguments[2] == "function") {
                  callback = arguments[2];
                  options = {};
                }
              Severity: Minor
              Found in lib/timeline/Core.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 _startAutoResize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              Core.prototype._startAutoResize = function () {
                var me = this;
              
                this._stopAutoResize();
              
              
              Severity: Minor
              Found in lib/timeline/Core.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 _updateScrollTop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              Core.prototype._updateScrollTop = function () {
                // recalculate the scrollTopMin
                var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero
                if (scrollTopMin != this.props.scrollTopMin) {
                  // in case of bottom orientation, change the scrollTop such that the contents
              Severity: Minor
              Found in lib/timeline/Core.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: move this function to Range
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              TODO found
              Open

                // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM)
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              TODO found
              Open

              // TODO: move this function to Range
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              TODO found
              Open

              // TODO: deprecated since version 1.1.0, remove some day
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              TODO found
              Open

                    // TODO: cleanup
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              TODO found
              Open

              // TODO: move this function to Range
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              TODO found
              Open

                // TODO: compensate borders when any of the panels is empty.
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              TODO found
              Open

              // TODO: move this function to Range
              Severity: Minor
              Found in lib/timeline/Core.js by fixme

              There are no issues that match your filters.

              Category
              Status