creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

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

  constructor() {
    //this.data = [[0, 0, 0]];

    //this.data=[[1, 5], [2, 5], [3, 4.9], [4, 4.8], [5, 5.2]];

Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/dygraphchart.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

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

    for (let i = 0; i < this.answers_array.length; i++) {
      this.answer_exp_array.push(
        {
          id: i,
          answer: this.answers_array[i],
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/quizx.js and 1 other location - About 3 hrs to fix
src_aurelia-bodylight-plugin/src/elements/quiz.js on lines 31..40

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

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

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

    bind() {
      if ((typeof this.vertical) === "string") this.vertical = this.vertical === 'true';
      if (this.w3class) {
          this.activeclass= this.w3class+ ' '+(this.vertical?this.activeclasstemplatevertical:this.activeclasstemplate);
          this.inactiveclass= this.w3class+' '+(this.vertical?this.inactiveclasstemplatevertical:this.inactiveclasstemplate);
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/tabs.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 computeYAxisRanges_ has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Dygraph.prototype.computeYAxisRanges_ = function (extremes) {
    // Build a map from axis number -> [list of series names]
    var seriesForAxis = [], series;
    for (series in this.seriesToAxisMap_) {
        if (!this.seriesToAxisMap_.hasOwnProperty(series)) continue;
Severity: Major
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 hrs to fix

    AnimateAdobe has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class AnimateAdobe {
        @bindable src;
        @bindable width=800;
        @bindable height=600;
        @bindable name;//="ZelezoCelek"
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js - About 3 hrs to fix

      Function isPixelChangingOptionList has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Dygraph.isPixelChangingOptionList = function(labels, attrs) {
          // A whitelist of options that do not change pixel positions.
          var pixelSafeOptions = {
              'annotationClickHandler': true,
              'annotationDblClickHandler': true,
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 hrs to fix

        Function abbr_replace has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function abbr_replace(state) {
            var i, j, l, tokens, token, text, nodes, pos, reg, m, regText, regSimple,
                currentToken,
                blockTokens = state.tokens;
        
        
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/elements/markdown-it-abbr-ext.js - About 3 hrs to fix

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

          Dygraph.prototype.computeYAxes_ = function() {
              // Preserve valueWindow settings if they exist, and if the user hasn't
              // specified a new valueRange.
              var i, valueWindows, seriesName, axis, index, opts, v;
              if (this.axes_ !== undefined && this.user_attrs_.hasOwnProperty("valueRange") === false) {
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 hrs to fix

            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

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

                if (context.touchDirections.x) {
                    g.dateWindow_ = [
                        c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale,
                        c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale
                    ];
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 3 hrs to fix
            src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 6747..6752

            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

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

                            if (this.chart.data.datasets[colorindex+3]) {
                                this.chart.data.datasets[colorindex+3].backgroundColor = this.previouscolorb2;
                                this.chart.data.datasets[colorindex+3].borderColor = this.previouscolorb2;
                            }
            src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.js on lines 112..115

            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

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

                        } else {
                            axis.valueWindow = [
                                c_init.dataY - swipe.dataY + (context.initialRange.y[0] - c_init.dataY) / yScale,
                                c_init.dataY - swipe.dataY + (context.initialRange.y[1] - c_init.dataY) / yScale
                            ];
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 3 hrs to fix
            src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 6735..6740

            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

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

                        if (this.chart.data.datasets[colorindex+1]) {
                            this.chart.data.datasets[colorindex+1].backgroundColor = this.previouscolor2;
                            this.chart.data.datasets[colorindex+1].borderColor = this.previouscolor2;
                        }
            src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.js on lines 144..147

            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

            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

            Function RGBColor has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

            function RGBColor(color_string)
            {
                this.ok = false;
            
                // strip any leading #
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 updateDeep has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

            Dygraph.updateDeep = function (self, o) {
                // Taken from http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
                function isNode(o) {
                    return (
                        typeof Node === "object" ? o instanceof Node :
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 bind has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                bind() {
                  super.bind();
                  this.plugins = [ChartDataLabels];
                  if (this.extremelimits) {
                    this.elimits = this.extremelimits.split(','); //split by comma
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/chartjs-barplot.js - About 3 hrs to fix

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

                constructor() {
                  //document.getElementById("id${window.ids - 2}").addEventListener("change", myfun${window.ids});
                  /*function myfun${window.ids}(event){
                      document.getElementById("id${window.ids - 1}").value = event.target.value;
                 }*/
              Severity: Minor
              Found in src_aurelia-bodylight-plugin/src/elements/bind2previous.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 getScript has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                getScript(source, callback) {
                  //check whether the script is not already there
                  if (Array.from(document.getElementsByTagName('script')).filter(x=> x.getAttribute('src') === source).length > 0) {
                    console.log('fmi.getScript() WARNING, script is already added into DOM:', source);
                    //do callback?
              Severity: Minor
              Found in src_aurelia-bodylight-plugin/src/elements/fmi.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 constructor has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  constructor() {
                    this.handleTick = e => {
                      this.currenttick++;
                      if (this.currenttick >= this.ticks2reset) {
                        //do reset values
              Severity: Minor
              Found in src_aurelia-bodylight-plugin/src/elements/buttonparams.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

              Severity
              Category
              Status
              Source
              Language