nnnick/Chart.js

View on GitHub

Showing 208 of 312 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.scale.js has 755 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.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.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

          File scale.time.js has 555 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 draw has 226 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 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 422 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 6 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 382 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

                      `` 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

                        Function draw has 117 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

                          Function fit has a Cognitive Complexity of 31 (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 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

                          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

                            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

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

                                'use strict';
                                
                                var DatasetController = require('../core/core.datasetController');
                                var defaults = require('../core/core.defaults');
                                var elements = require('../elements/index');
                                Severity: Minor
                                Found in src/controllers/controller.doughnut.js - About 3 hrs to fix

                                  Function drawPoint has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      drawPoint: function(ctx, style, radius, x, y, rotation) {
                                          var type, xOffset, yOffset, size, cornerRadius;
                                          var rad = (rotation || 0) * RAD_PER_DEG;
                                  
                                          if (style && typeof style === 'object') {
                                  Severity: Major
                                  Found in src/helpers/helpers.canvas.js - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language