nnnick/Chart.js

View on GitHub

Showing 204 of 311 total issues

Function exports has a Cognitive Complexity of 207 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function() {

    // -- Basic js utility methods

    helpers.where = function(collection, filterCallback) {
Severity: Minor
Found in src/core/core.helpers.js - About 4 days 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 exports has 474 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function() {

    // -- Basic js utility methods

    helpers.where = function(collection, filterCallback) {
Severity: Major
Found in src/core/core.helpers.js - About 2 days to fix

    File core.tooltip.js has 735 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var defaults = require('./core.defaults');
    var Element = require('./core.element');
    var helpers = require('../helpers/index');
    Severity: Major
    Found in src/core/core.tooltip.js - About 1 day to fix

      File core.scale.js has 715 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      var defaults = require('./core.defaults');
      var Element = require('./core.element');
      var helpers = require('../helpers/index');
      Severity: Major
      Found in src/core/core.scale.js - About 1 day to fix

        File core.controller.js has 678 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        var Animation = require('./core.animation');
        var animations = require('./core.animations');
        var controllers = require('../controllers/index');
        Severity: Major
        Found in src/core/core.controller.js - About 1 day to fix

          Function draw has 231 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              draw: function(chartArea) {
                  var me = this;
                  var options = me.options;
          
                  if (!me._isVisible()) {
          Severity: Major
          Found in src/core/core.scale.js - About 1 day to fix

            File scale.time.js has 534 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            var adapters = require('../core/core.adapters');
            var defaults = require('../core/core.defaults');
            var helpers = require('../helpers/index');
            Severity: Major
            Found in src/scales/scale.time.js - About 1 day to fix

              Function update has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
              Open

                  update: function(reset) {
                      var me = this;
                      var chart = me.chart;
                      var chartArea = chart.chartArea;
                      var opts = chart.options;
              Severity: Minor
              Found in src/controllers/controller.doughnut.js - About 7 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 core.helpers.js has 480 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* global window: false */
              /* global document: false */
              'use strict';
              
              var color = require('chartjs-color');
              Severity: Minor
              Found in src/core/core.helpers.js - About 7 hrs to fix

                File plugin.legend.js has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                var defaults = require('../core/core.defaults');
                var Element = require('../core/core.element');
                var helpers = require('../helpers/index');
                Severity: Minor
                Found in src/plugins/plugin.legend.js - About 5 hrs to fix

                  Function update has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      update: function(chart, width, height) {
                          if (!chart) {
                              return;
                          }
                  
                  
                  Severity: Major
                  Found in src/core/core.layouts.js - About 5 hrs to fix

                    File scale.radialLinear.js has 383 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    'use strict';
                    
                    var defaults = require('../core/core.defaults');
                    var helpers = require('../helpers/index');
                    var LinearScaleBase = require('./scale.linearbase');
                    Severity: Minor
                    Found in src/scales/scale.radialLinear.js - About 5 hrs to fix

                      Function fit has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                          fit: function() {
                              var me = this;
                              // Reset
                              var minSize = me.minSize = {
                                  width: 0,
                      Severity: Minor
                      Found in src/core/core.scale.js - About 5 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

                      `` has 38 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      helpers.extend(Chart.prototype, /** @lends Chart */ {
                          /**
                           * @private
                           */
                          construct: function(item, config) {
                      Severity: Minor
                      Found in src/core/core.controller.js - About 5 hrs to fix

                        exports has 34 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        module.exports = Element.extend({
                            /**
                             * Get the padding needed for the scale
                             * @method getPadding
                             * @private
                        Severity: Minor
                        Found in src/core/core.scale.js - About 4 hrs to fix

                          Function update has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                          Open

                              update: function(chart, width, height) {
                                  if (!chart) {
                                      return;
                                  }
                          
                          
                          Severity: Minor
                          Found in src/core/core.layouts.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

                          Function draw has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              draw: function() {
                                  var me = this;
                                  var opts = me.options;
                                  var labelOpts = opts.labels;
                                  var globalDefaults = defaults.global;
                          Severity: Major
                          Found in src/plugins/plugin.legend.js - About 4 hrs to fix

                            effects has 31 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            var effects = {
                                linear: function(t) {
                                    return t;
                                },
                            
                            
                            Severity: Minor
                            Found in src/helpers/helpers.easing.js - About 3 hrs to fix

                              Function determineDataLimits has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  determineDataLimits: function() {
                                      var me = this;
                                      var opts = me.options;
                                      var chart = me.chart;
                                      var data = chart.data;
                              Severity: Major
                              Found in src/scales/scale.linear.js - About 3 hrs to fix

                                Function draw has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    draw: function(chartArea) {
                                        var me = this;
                                        var options = me.options;
                                
                                        if (!me._isVisible()) {
                                Severity: Minor
                                Found in src/core/core.scale.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

                                Severity
                                Category
                                Status
                                Source
                                Language