creative-connections/Bodylight.js-Components

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

Summary

Maintainability
D
2 days
Test Coverage

Function constructor has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor() {
    super();    
    this.customBackgroundPlugin = {
      beforeDatasetsDraw: function(chart, easing) {
        const acidbaseannotation = [[7.4,40,"Normal area"],
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-sachart.js - About 1 hr to fix

    Function beforeDatasetsDraw has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          beforeDatasetsDraw: function(chart, easing) {
            const acidbaseannotation = [[7.4,40,"Normal area"],
            [7.2,64,"Acute Hypercapnia"],
            [7.1,35,"Acute Base Deficit"],
            [7.1,18,"Chronic Base Deficit"],
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-sachart.js - About 1 hr to fix

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

        constructor() {
          super();    
          this.customBackgroundPlugin = {
            beforeDatasetsDraw: function(chart, easing) {
              const acidbaseannotation = [[7.4,40,"Normal area"],
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-sachart.js - About 35 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(xAxis.getPixelForValue(acidbaselimitborders[i][0][0]), yAxis.getPixelForValue(acidbaselimitborders[i][0][1]));
                              for (let j = 1; j < acidbaselimitborders[i].length; j++) {
                                  canvas.lineTo(xAxis.getPixelForValue(acidbaselimitborders[i][j][0]), yAxis.getPixelForValue(acidbaselimitborders[i][j][1]));
      src_aurelia-bodylight-plugin/src/elements/sachart.js on lines 157..164

      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

            const 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]]];
      src_aurelia-bodylight-plugin/src/elements/sachart.js on lines 115..118

      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 = "10px Verdana";
      
                            let cx = xAxis.getPixelForValue(acidbaseannotation[i][0]);
      src_aurelia-bodylight-plugin/src/elements/sachart.js on lines 176..185

      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