nagix/chartjs-plugin-colorschemes

View on GitHub

Showing 6 of 13 total issues

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

module.exports = function(karma) {
    const args = karma.args || {};
    const regex = args.watch ? /\.js$/ : /\.min\.js$/;
    const build = builds.filter((v) => v.output.file.match(regex))[0];

Severity: Major
Found in karma.config.js - About 3 hrs to fix

    Function beforeUpdate has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        beforeUpdate: function(chart, args, options) {
            // Please note that in v3, the args argument was added. It was not used before it was added,
            // so we just check if it is not actually our options object
            if (options === undefined) {
                options = args;
    Severity: Major
    Found in src/plugins/plugin.colorschemes.js - About 3 hrs to fix

      File colorschemes.brewer.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      // eslint-disable-next-line one-var
      export var
          // Sequential
      Severity: Minor
      Found in src/colorschemes/colorschemes.brewer.js - About 2 hrs to fix

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

            afterUpdate: function(chart) {
                // Unset colors
                chart.config.data.datasets.forEach(function(dataset) {
                    if (dataset[EXPANDO_KEY]) {
                        if (dataset[EXPANDO_KEY].hasOwnProperty('backgroundColor')) {
        Severity: Minor
        Found in src/plugins/plugin.colorschemes.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 beforeUpdate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            beforeUpdate: function(chart, args, options) {
                // Please note that in v3, the args argument was added. It was not used before it was added,
                // so we just check if it is not actually our options object
                if (options === undefined) {
                    options = args;
        Severity: Minor
        Found in src/plugins/plugin.colorschemes.js - About 55 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 getScheme has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function getScheme(scheme) {
            var colorschemes, matches, arr, category;
        
            if (helpers.isArray(scheme)) {
                return scheme;
        Severity: Minor
        Found in src/plugins/plugin.colorschemes.js - About 45 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

        Severity
        Category
        Status
        Source
        Language