nnnick/Chart.js

View on GitHub

Showing 312 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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          _resolvePointOptions: function(element, index) {
              var me = this;
              var chart = me.chart;
              var dataset = chart.data.datasets[me.index];
              var custom = element.custom || {};
      Severity: Major
      Found in src/controllers/controller.radar.js and 1 other location - About 1 day to fix
      src/controllers/controller.line.js on lines 131..174

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 311.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          _resolvePointOptions: function(element, index) {
              var me = this;
              var chart = me.chart;
              var dataset = chart.data.datasets[me.index];
              var custom = element.custom || {};
      Severity: Major
      Found in src/controllers/controller.line.js and 1 other location - About 1 day to fix
      src/controllers/controller.radar.js on lines 114..157

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 311.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              _resolveElementOptions: function(arc, index) {
                  var me = this;
                  var chart = me.chart;
                  var dataset = me.getDataset();
                  var custom = arc.custom || {};
          Severity: Major
          Found in src/controllers/controller.doughnut.js and 1 other location - About 1 day to fix
          src/controllers/controller.polarArea.js on lines 247..284

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 230.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              _resolveElementOptions: function(arc, index) {
                  var me = this;
                  var chart = me.chart;
                  var dataset = me.getDataset();
                  var custom = arc.custom || {};
          Severity: Major
          Found in src/controllers/controller.polarArea.js and 1 other location - About 1 day to fix
          src/controllers/controller.doughnut.js on lines 352..389

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 230.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  legendCallback: function(chart) {
                      var text = [];
                      text.push('<ul class="' + chart.id + '-legend">');
              
                      var data = chart.data;
              Severity: Major
              Found in src/controllers/controller.polarArea.js and 1 other location - About 1 day to fix
              src/controllers/controller.doughnut.js on lines 25..45

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 211.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  legendCallback: function(chart) {
                      var text = [];
                      text.push('<ul class="' + chart.id + '-legend">');
              
                      var data = chart.data;
              Severity: Major
              Found in src/controllers/controller.doughnut.js and 1 other location - About 1 day to fix
              src/controllers/controller.polarArea.js on lines 34..54

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 211.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  setDimensions: function() {
                      var me = this;
                      // Set the unconstrained dimension before label rotation
                      if (me.isHorizontal()) {
                          // Reset position before calculating rotation
              Severity: Major
              Found in src/plugins/plugin.title.js and 1 other location - About 1 day to fix
              src/plugins/plugin.legend.js on lines 160..187

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 201.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  setDimensions: function() {
                      var me = this;
                      // Set the unconstrained dimension before label rotation
                      if (me.isHorizontal()) {
                          // Reset position before calculating rotation
              Severity: Major
              Found in src/plugins/plugin.legend.js and 1 other location - About 1 day to fix
              src/plugins/plugin.title.js on lines 72..99

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 201.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  update: function(maxWidth, maxHeight, margins) {
                      var me = this;
              
                      // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
                      me.beforeUpdate();
              Severity: Major
              Found in src/plugins/plugin.title.js and 1 other location - About 7 hrs to fix
              src/plugins/plugin.legend.js on lines 126..154

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 194.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  update: function(maxWidth, maxHeight, margins) {
                      var me = this;
              
                      // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
                      me.beforeUpdate();
              Severity: Major
              Found in src/plugins/plugin.legend.js and 1 other location - About 7 hrs to fix
              src/plugins/plugin.title.js on lines 37..66

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 194.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  setHoverStyle: function(point) {
                      var model = point._model;
                      var options = point._options;
                      var getHoverColor = helpers.getHoverColor;
              
              
              Severity: Major
              Found in src/controllers/controller.line.js and 1 other location - About 7 hrs to fix
              src/controllers/controller.radar.js on lines 224..240

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 193.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  setHoverStyle: function(point) {
                      var model = point._model;
                      var options = point._options;
                      var getHoverColor = helpers.getHoverColor;
              
              
              Severity: Major
              Found in src/controllers/controller.radar.js and 1 other location - About 7 hrs to fix
              src/controllers/controller.line.js on lines 350..366

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 193.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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
                Severity
                Category
                Status
                Source
                Language