creative-connections/Bodylight.js-Components

View on GitHub
src_aurelia-bodylight-plugin/src/elements/sachart.js

Summary

Maintainability
F
3 days
Test Coverage

Function initdygraph has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initdygraph() {
        console.log('sachart - initdygraph');
        if (this.pH >0) this.data = [[this.pH, this.pCO2]];
        else this.data = [];
        this.xaxis = "pH";
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/sachart.js - About 2 hrs to fix

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

        constructor() {
            super();
            console.log('sachart constructor');
            this.xy = true; //set xy chart - datapoint will not contain time point
            this.handleResize = () => {
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/sachart.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 initdygraph has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        initdygraph() {
            console.log('sachart - initdygraph');
            if (this.pH >0) this.data = [[this.pH, this.pCO2]];
            else this.data = [];
            this.xaxis = "pH";
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/sachart.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 underlayCallback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                underlayCallback: function (canvas, area, g) {
                    //draw area of limit borders
                    //console.log("gradients [0][0..2]:" + g.toDomXCoord(gradient[0][0]) + " " + g.toDomXCoord(gradient[0][1]) + " " + g.toDomXCoord(gradient[0][2]));
                    if (isNaN(g.toDomXCoord(gradient[0][0]))) {
                        console.log("cannot draw gradients [0][0..2]:" + g.toDomXCoord(gradient[0][0]) + " " + g.toDomXCoord(gradient[0][1]) + " " + g.toDomXCoord(gradient[0][2]));
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/sachart.js - About 1 hr to fix

      Function isElementVisible has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          isElementVisible(element) {
              // Check if the element itself is set to display: none
              if (window.getComputedStyle(element).display === "none") {
                  return false;
              }
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/sachart.js - About 25 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

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

                          for (let i = 0; i < acidbaselimitborders.length; i++) {
                              canvas.beginPath();
                              canvas.moveTo(g.toDomXCoord(acidbaselimitborders[i][0][0]), g.toDomYCoord(acidbaselimitborders[i][0][1]));
                              for (let j = 1; j < acidbaselimitborders[i].length; j++) {
                                  canvas.lineTo(g.toDomXCoord(acidbaselimitborders[i][j][0]), g.toDomYCoord(acidbaselimitborders[i][j][1]));
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/sachart.js and 1 other location - About 7 hrs to fix
      src_aurelia-bodylight-plugin/src/elements/chartjs-xy-sachart.js on lines 50..57

      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 182.

      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

              this.acidbaselimitborders = [[[7.8, 10.8], [7.46, 29.1], [7.3, 46.8], [6.89, 148], [6.96, 148], [7.33, 52.1], [7.47, 36.6], [7.8, 13.8]],
              [[7.54, 64.7], [7.42, 52.1], [7.33, 41.4], [7.22, 28.7], [7.14, 18.4], [7.07, 11.6], [7.25, 11.6], [7.28, 15.8], [7.31, 22.8], [7.38, 29.1], [7.47, 37.6], [7.52, 41.4], [7.57, 44.3], [7.66, 47.3]],
              [[7.0, 40.7], [7.09, 43.9], [7.2, 45.5], [7.39, 45.5], [7.39, 32.1], [7.25, 31.7], [7.18, 30.5], [7.06, 27.6], [7.0, 25.3]],
              [[7.412, 18.90], [7.389, 30.3], [7.354, 50.7], [7.303, 65.6], [7.221, 96.3], [7.281, 96.3], [7.37, 66.2], [7.41, 51.0], [7.44, 38.7], [7.46, 29.1], [7.48, 18.5]]];
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/sachart.js and 1 other location - About 7 hrs to fix
      src_aurelia-bodylight-plugin/src/elements/chartjs-xy-sachart.js on lines 30..33

      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 178.

      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

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

                          for (let i = 0; i < acidbaseannotation.length; i++) {
                              canvas.fillStyle = "#1030ff";
                              canvas.font = "12px Verdana";
      
                              let cx = g.toDomXCoord(acidbaseannotation[i][0]);
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/sachart.js and 1 other location - About 3 hrs to fix
      src_aurelia-bodylight-plugin/src/elements/chartjs-xy-sachart.js on lines 58..67

      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 97.

      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

      There are no issues that match your filters.

      Category
      Status