creative-connections/Bodylight.js-Components

View on GitHub

Showing 430 of 684 total issues

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

Dygraph.prototype.destroy = function() {
    var removeRecursive = function(node) {
        while (node.hasChildNodes()) {
            removeRecursive(node.firstChild);
            node.removeChild(node.firstChild);
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 resize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

Dygraph.prototype.resize = function(width, height) {
    if (this.resize_lock) {
        return;
    }
    this.resize_lock = true;
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 _dashedLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

DygraphCanvasRenderer.prototype._dashedLine = function(ctx, x, y, x2, y2, pattern) {
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if (den) {
                            var p = value < 0 ? 0 : value, n = den;
                            var pm = sigma * Math.sqrt(p*(1-p)/n + sigma*sigma/(4*n*n));
                            var denom = 1 + sigma * sigma / den;
                            low  = (p + sigma * sigma / (2 * den) - pm) / denom;
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for (var k = 0; k < annotationCols[col].length; k++) {
                              if (k) ann.text += "\n";
                              ann.text += data.getValue(i, annotationCols[col][k]);
                          }
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      if (window.bodylightnavopenhide) window.bodylightnavopenhide(currentnavitem.parentNode.parentNode.previousSibling);
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/elements/markdown-top-nav.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if (currentnavitem.parentNode.parentNode && currentnavitem.parentNode.parentNode.parentNode && currentnavitem.parentNode.parentNode.parentNode.className === 'w3-hide')
                          if (window.bodylightnavopenhide) window.bodylightnavopenhide(currentnavitem.parentNode.parentNode.parentNode.previousSibling);
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/elements/markdown-top-nav.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if (stepPlot) {
                                    newYs = [ point.y_bottom, point.y_top ];
                                    prevY = point.y;
                                } else {
                                    newYs = [ point.y_bottom, point.y_top ];
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if (point.name == setName) { // TODO(klausw): this is always true
                                  if (!Dygraph.isOK(point.y)) {
                                      prevX = NaN;
                                      continue;
                                  }
              Severity: Major
              Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                if (num_ok) {
                                    stddev = Math.sqrt(variance) / num_ok;
                                    rollingData[i] = [originalData[i][0],
                                        [sum / num_ok, sigma * stddev, sigma * stddev]];
                                } else {
                Severity: Major
                Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

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

                      bind(){
                          super.bind();
                          this.type = 'scatter';
                          this.data.labels = [];
                          this.xrefindex = parseInt(this.xrefindex, 10);
                  Severity: Minor
                  Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.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 deeply nested control flow statements.
                  Open

                                  if (cumulative_y[x] > seriesExtremes[1]) {
                                      seriesExtremes[1] = cumulative_y[x];
                                  }
                  Severity: Major
                  Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if (num_ok) {
                                        rollingData[i] = [originalData[i][0], sum / num_ok];
                                    } else {
                                        rollingData[i] = [originalData[i][0], null];
                                    }
                    Severity: Major
                    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

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

                          setAnswer(qid2,answer){
                              let qid = qid2;
                              if (qid2.includes(';')) qid = qid2.split(';')[0]; //first is id second is id of related tabs
                              if (this.quizids.includes(qid2)) {
                                  // Check if an item with id 'id2' exists
                      Severity: Minor
                      Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.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 deeply nested control flow statements.
                      Open

                                  for (j = 1; j < inFields.length; j++) {
                                      var val = inFields[j];
                                      if (/^ *$/.test(val)) {
                                          fields[j] = [null, null, null];
                                      } else {
                      Severity: Major
                      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if (g == 7) {  // one week
                                                d.setDate(d.getDate() - d.getDay());
                                            }
                        Severity: Major
                        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

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

                          const registerCustomElementFunction = () => {
                            //register e.g. click on abbr element will show title and allows expand to url - wikipedia content
                            //click on abbr will show extended modal info and link 
                            
                            //click on abbreviation shows a sibling dialog, if presented
                          Severity: Minor
                          Found in src_aurelia-bodylight-plugin/src/elements/markdownaurelia.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 deeply nested control flow statements.
                          Open

                                              if (stepPlot) {
                                                  strategy.drawLine(prevCanvasX, prevCanvasY, point.canvasx, prevCanvasY);
                                                  prevCanvasX = point.canvasx;
                                              }
                          Severity: Major
                          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if (prev[1][1] !== null && !isNaN(prev[1][1])) {
                                                low -= prev[1][0];
                                                mid -= prev[1][1];
                                                high -= prev[1][2];
                                                count -= 1;
                            Severity: Major
                            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if (attrs[property].hasOwnProperty(subProperty) && !pixelSafeOptions[subProperty]) {
                                                      requiresNewPoints = true;
                                                  }
                              Severity: Major
                              Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language