lib/timeline/component/DataAxis.js

Summary

Maintainability
D
2 days
Test Coverage

File DataAxis.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var util = require('../../util');
var DOMutil = require('../../DOMutil');
var Component = require('./Component');
var DataScale = require('./DataScale');
/**
Severity: Minor
Found in lib/timeline/component/DataAxis.js - About 6 hrs to fix

    Function _redrawLabels has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    DataAxis.prototype._redrawLabels = function () {
      var resized = false;
      DOMutil.prepareElements(this.DOMelements.lines);
      DOMutil.prepareElements(this.DOMelements.labels);
      var orientation = this.options['orientation'];
    Severity: Major
    Found in lib/timeline/component/DataAxis.js - About 3 hrs to fix

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

      DataAxis.prototype.redraw = function () {
        var resized = false;
        var activeGroups = 0;
      
        // Make sure the line container adheres to the vertical scrolling.
      Severity: Minor
      Found in lib/timeline/component/DataAxis.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 DataAxis has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function DataAxis(body, options, svg, linegraphOptions) {
        this.id = util.randomUUID();
        this.body = body;
      
        this.defaultOptions = {
      Severity: Major
      Found in lib/timeline/component/DataAxis.js - About 2 hrs to fix

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

        DataAxis.prototype.redraw = function () {
          var resized = false;
          var activeGroups = 0;
        
          // Make sure the line container adheres to the vertical scrolling.
        Severity: Major
        Found in lib/timeline/component/DataAxis.js - About 2 hrs to fix

          Function _calculateCharSize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          DataAxis.prototype._calculateCharSize = function () {
            // determine the char width and height on the minor axis
            if (!('minorCharHeight' in this.props)) {
              var textMinor = document.createTextNode('0');
              var measureCharMinor = document.createElement('div');
          Severity: Minor
          Found in lib/timeline/component/DataAxis.js - About 1 hr to fix

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

            DataAxis.prototype.setOptions = function (options) {
              if (options) {
                var redraw = false;
                if (this.options.orientation != options.orientation && options.orientation !== undefined) {
                  redraw = true;
            Severity: Minor
            Found in lib/timeline/component/DataAxis.js - About 1 hr to fix

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

              DataAxis.prototype._redrawLabels = function () {
                var resized = false;
                DOMutil.prepareElements(this.DOMelements.lines);
                DOMutil.prepareElements(this.DOMelements.labels);
                var orientation = this.options['orientation'];
              Severity: Minor
              Found in lib/timeline/component/DataAxis.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 _redrawLabel has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              DataAxis.prototype._redrawLabel = function (y, text, orientation, className, characterHeight) {
              Severity: Minor
              Found in lib/timeline/component/DataAxis.js - About 35 mins to fix

                Function _redrawLine has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) {
                Severity: Minor
                Found in lib/timeline/component/DataAxis.js - About 35 mins to fix

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

                  DataAxis.prototype.setOptions = function (options) {
                    if (options) {
                      var redraw = false;
                      if (this.options.orientation != options.orientation && options.orientation !== undefined) {
                        redraw = true;
                  Severity: Minor
                  Found in lib/timeline/component/DataAxis.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 _redrawTitle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  DataAxis.prototype._redrawTitle = function (orientation) {
                    DOMutil.prepareElements(this.DOMelements.title);
                  
                    // Check if the title is defined for this axes
                    if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) {
                  Severity: Minor
                  Found in lib/timeline/component/DataAxis.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

                  Function _redrawGroupIcons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  DataAxis.prototype._redrawGroupIcons = function () {
                    DOMutil.prepareElements(this.svgElements);
                  
                    var x;
                    var iconWidth = this.options.iconWidth;
                  Severity: Minor
                  Found in lib/timeline/component/DataAxis.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

                  There are no issues that match your filters.

                  Category
                  Status