nagix/chartjs-plugin-datasource

View on GitHub

Showing 21 of 40 total issues

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

function query(obj, expr) {
    var regex = /(?:,|^)\s*(?:"([^"]*)"|'([^']*)'|([^,\s]*))/gi;
    var result = [];
    var matches, bracketKey, dotKey, nextExprWithDot, nextExpr, quotedKey, subset, i, ilen, keys;

Severity: Minor
Found in src/datasources/datasource.json.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 convert has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    convert: function(input) {
        var me = this;
        var options = me._options;
        var workbook = XLSX.read(new Uint8Array(input), {type: 'array'});
        var dataRange = parseExpression(workbook, datasourceHelpers.valueOrDefault(options.data, ''));
Severity: Minor
Found in src/datasources/datasource.sheet.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 convert has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    convert: function(input) {
        var me = this;
        var options = me._options;
        var arrays = csvToArrays(input, options.delimiter);
        var datasets = [];
Severity: Minor
Found in src/datasources/datasource.csv.js - About 2 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 exports has 72 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 2 hrs to fix

    Function mergeData has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    function mergeData(target, source) {
        var sourceDatasets = source.datasets;
        var targetDatasets = target.datasets;
        var sourceLabels = source.labels;
        var targetLabels = target.labels;
    Severity: Minor
    Found in src/plugins/plugin.datasource.js - About 2 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 convert has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        convert: function(input) {
            var me = this;
            var options = me._options;
            var workbook = XLSX.read(new Uint8Array(input), {type: 'array'});
            var dataRange = parseExpression(workbook, datasourceHelpers.valueOrDefault(options.data, ''));
    Severity: Major
    Found in src/datasources/datasource.sheet.js - About 2 hrs to fix

      Function convert has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          convert: function(input) {
              var me = this;
              var options = me._options;
              var datasets = [];
              var datasetLabels, indexLabels, data, arrays, i, ilen;
      Severity: Minor
      Found in src/datasources/datasource.json.js - About 2 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 convert has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          convert: function(input) {
              var me = this;
              var options = me._options;
              var datasets = [];
              var datasetLabels, indexLabels, data, arrays, i, ilen;
      Severity: Major
      Found in src/datasources/datasource.json.js - About 2 hrs to fix

        Function convert has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            convert: function(input) {
                var me = this;
                var options = me._options;
                var arrays = csvToArrays(input, options.delimiter);
                var datasets = [];
        Severity: Major
        Found in src/datasources/datasource.csv.js - About 2 hrs to fix

          Function csvToArrays has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          function csvToArrays(str, delimiter) {
              var regex = new RegExp('(' + delimiter +
                  '|\r?\n(?!$)|\r(?!$)|^(?!$))(?:"((?:\\.|""|[^\\"])*)"|([^' + delimiter + '"\r\n]*))', 'gi');
              var array = [];
              var arrays = [array];
          Severity: Minor
          Found in src/datasources/datasource.csv.js - About 2 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 query has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          function query(sheetRange, options) {
              var sheet = sheetRange.sheet;
              var range = sheetRange.range;
              var r = options && options.columnOriented ? 'c' : 'r';
              var c = options && options.columnOriented ? 'r' : 'c';
          Severity: Minor
          Found in src/datasources/datasource.sheet.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 getPointData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function getPointData(arrays, datasetLabels, datapointLabelMapping) {
              var keys = Object.keys(datapointLabelMapping);
              var datapointLabelLookup = {};
              var datasetLabelLookup = {};
              var result = [];
          Severity: Minor
          Found in src/datasources/datasource.json.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 parseExpression has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function parseExpression(workbook, expr) {
              var matches, sheetName, sheet, rangeExpr, ref, range, refRange;
          
              while (expr) {
                  if (expr.match(/^(([A-Z]+\d*|[A-Z]*\d+):([A-Z]+\d*|[A-Z]*\d+)|[A-Z]+\d+)$/)) {
          Severity: Minor
          Found in src/datasources/datasource.sheet.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 query has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function query(obj, expr) {
              var regex = /(?:,|^)\s*(?:"([^"]*)"|'([^']*)'|([^,\s]*))/gi;
              var result = [];
              var matches, bracketKey, dotKey, nextExprWithDot, nextExpr, quotedKey, subset, i, ilen, keys;
          
          
          Severity: Minor
          Found in src/datasources/datasource.json.js - About 1 hr to fix

            Function mergeData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function mergeData(target, source) {
                var sourceDatasets = source.datasets;
                var targetDatasets = target.datasets;
                var sourceLabels = source.labels;
                var targetLabels = target.labels;
            Severity: Minor
            Found in src/plugins/plugin.datasource.js - About 1 hr to fix

              Function parseExpression has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function parseExpression(workbook, expr) {
                  var matches, sheetName, sheet, rangeExpr, ref, range, refRange;
              
                  while (expr) {
                      if (expr.match(/^(([A-Z]+\d*|[A-Z]*\d+):([A-Z]+\d*|[A-Z]*\d+)|[A-Z]+\d+)$/)) {
              Severity: Minor
              Found in src/datasources/datasource.sheet.js - About 1 hr to fix

                Function getPointData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getPointData(arrays, datasetLabels, datapointLabelMapping) {
                    var keys = Object.keys(datapointLabelMapping);
                    var datapointLabelLookup = {};
                    var datasetLabelLookup = {};
                    var result = [];
                Severity: Minor
                Found in src/datasources/datasource.json.js - About 1 hr to fix

                  Function getPointData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getPointData(arrays, datasetLabels, datapointLabels) {
                      var lookup = {};
                      var result = [];
                      var array, obj, datapointLabel, datapointValue, i, j, ilen, jlen;
                  
                  
                  Severity: Minor
                  Found in src/datasources/datasource.csv.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

                  Function getPointData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getPointData(arrays, datasetLabels, datapointLabels) {
                      var lookup = {};
                      var result = [];
                      var array, obj, datapointLabel, datapointValue, i, j, ilen, jlen;
                  
                  
                  Severity: Minor
                  Found in src/datasources/datasource.sheet.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

                  Avoid too many return statements within this function.
                  Open

                      return result.length > 1 ? result : result[0];
                  Severity: Major
                  Found in src/datasources/datasource.json.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language