lib/timeline/component/TimeAxis.js

Summary

Maintainability
D
2 days
Test Coverage

Function _repaintLabels has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

TimeAxis.prototype._repaintLabels = function () {
  var orientation = this.options.orientation.axis;

  // calculate range and step (step such that we have space for 7 characters per label)
  var start = util.convert(this.body.range.start, 'Number');
Severity: Minor
Found in lib/timeline/component/TimeAxis.js - About 4 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 TimeAxis.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var util = require('../../util');
var Component = require('./Component');
var TimeStep = require('../TimeStep');
var DateUtil = require('../DateUtil');
var moment = require('../../module/moment');
Severity: Minor
Found in lib/timeline/component/TimeAxis.js - About 4 hrs to fix

    Function _repaintLabels has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    TimeAxis.prototype._repaintLabels = function () {
      var orientation = this.options.orientation.axis;
    
      // calculate range and step (step such that we have space for 7 characters per label)
      var start = util.convert(this.body.range.start, 'Number');
    Severity: Major
    Found in lib/timeline/component/TimeAxis.js - About 4 hrs to fix

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

      TimeAxis.prototype.setOptions = function(options) {
        if (options) {
          // copy all options that we know
          util.selectiveExtend([
            'showMinorLabels',
      Severity: Minor
      Found in lib/timeline/component/TimeAxis.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 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      TimeAxis.prototype.redraw = function () {
        var props = this.props;
        var foreground = this.dom.foreground;
        var background = this.dom.background;
      
      
      Severity: Minor
      Found in lib/timeline/component/TimeAxis.js - About 1 hr to fix

        Function TimeAxis has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function TimeAxis (body, options) {
          this.dom = {
            foreground: null,
            lines: [],
            majorTexts: [],
        Severity: Minor
        Found in lib/timeline/component/TimeAxis.js - About 1 hr to fix

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

          TimeAxis.prototype.setOptions = function(options) {
            if (options) {
              // copy all options that we know
              util.selectiveExtend([
                'showMinorLabels',
          Severity: Minor
          Found in lib/timeline/component/TimeAxis.js - About 1 hr to fix

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

            TimeAxis.prototype.redraw = function () {
              var props = this.props;
              var foreground = this.dom.foreground;
              var background = this.dom.background;
            
            
            Severity: Minor
            Found in lib/timeline/component/TimeAxis.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

            TODO found
            Open

              props.minorLineWidth = 1; // TODO: really calculate width
            Severity: Minor
            Found in lib/timeline/component/TimeAxis.js by fixme

            TODO found
            Open

              // TODO: recalculate sizes only needed when parent is resized or options is changed
            Severity: Minor
            Found in lib/timeline/component/TimeAxis.js by fixme

            TODO found
            Open

              //label.title = title;  // TODO: this is a heavy operation
            Severity: Minor
            Found in lib/timeline/component/TimeAxis.js by fixme

            TODO found
            Open

              props.majorLineWidth = 1; // TODO: really calculate width
            Severity: Minor
            Found in lib/timeline/component/TimeAxis.js by fixme

            TODO found
            Open

              //label.title = title; // TODO: this is a heavy operation
            Severity: Minor
            Found in lib/timeline/component/TimeAxis.js by fixme

            TODO found
            Open

                // TODO: not so nice, this is applied globally to moment.js
            Severity: Minor
            Found in lib/timeline/component/TimeAxis.js by fixme

            There are no issues that match your filters.

            Category
            Status