creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

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

    bind() {
        if (typeof (this.smooth) === 'string') this.smooth = this.smooth === 'true';
        if (typeof (this.step) === 'string') this.step = parseFloat(this.step);
        if (typeof (this.showicons) === 'string') this.showicons = this.showicons === 'true';
        if (typeof (this.globalanim) === 'string') this.globalanim = this.globalanim === 'true';
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/range.js - About 1 day 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

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

File chartjs.js has 470 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Chart from 'chart.js';
import ChartDataLabels from 'chartjs-plugin-datalabels';
import {bindable} from 'aurelia-framework';
import _ from 'lodash';

Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs.js - About 7 hrs to fix

    Function Legend has 181 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Dygraph.Plugins.Legend = (function() {
    
        /*
    
    Current bits of jankiness:
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 7 hrs to fix

      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

      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

      Function updatetitles has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        updatetitles(hashstruct) {
            //this.currentlink
            console.log('top nav hash:', hashstruct);
            if (window.markdownnav) {
              let currentlink = '#' + (hashstruct[0].length > 0 ? hashstruct[0] : this.index);
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/markdown-top-nav.js - About 7 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 attached has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

        attached() {
          //console.log('chartjs attached');
          //listening to custom event fmidata and fmireset
          const fromel = document.getElementById(this.fromid);
          if (fromel) {
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/chartjs.js - About 6 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 169 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        bind() {
          //console.log('chartjs bind');
          if (typeof this.displayxticks === 'string') this.displayxticks = this.displayxticks === 'true'; 
          if ((typeof this.refindex == 'string') && (this.refindex.indexOf(',')>0)) { this.refindices = this.refindex.split(',')}
          else {
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/chartjs.js - About 6 hrs to fix

        Fmi has 48 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class Fmi {
          @bindable fminame='';
          @bindable fmifunctionprefixname='';
          @bindable tolerance=0.000001;//0.000030517578
          @bindable starttime=0;
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/elements/fmi.js - About 6 hrs to fix

          Function _renderLineChart has 162 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          DygraphCanvasRenderer.prototype._renderLineChart = function() {
              // TODO(danvk): use this.attr_ for many of these.
              var ctx = this.elementContext;
              var fillAlpha = this.attr_('fillAlpha');
              var errorBars = this.attr_("errorBars") || this.attr_("customBars");
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 6 hrs to fix

            Function _drawSeries has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

            DygraphCanvasRenderer.prototype._drawSeries = function(
                ctx, iter, strokeWidth, pointSize, drawPoints, drawGapPoints,
                stepPlot, strategy) {
            
                var prevCanvasX = null;
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 6 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 getDateAxis has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

            Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
                var formatter = opts("axisLabelFormatter");
                var ticks = [];
                var t;
            
            
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 6 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 computeYAxes_ has a Cognitive Complexity of 42 (exceeds 5 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: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 6 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 valueChanged has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

                valueChanged(newValue, oldValue) {
                    //if (oldValue !== newValue)
                    if (this.ids) {
                        //semaphore only one change in time is allowed
                        if (!window.rangebinding) {
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/range.js - About 6 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

                removeScript(source) {
                  let src = window.bdlBaseHref ? window.bdlBaseHref + source : source;
                  let tags = document.getElementsByTagName('script');
                  for (let i = tags.length; i >= 0; i--) { //search backwards within nodelist for matching elements to remove
                    if (tags[i] && tags[i].getAttribute('src') !== null && tags[i].getAttribute('src').indexOf(src) !== -1) {tags[i].parentNode.removeChild(tags[i]);} //remove element by calling parentNode.removeChild()
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js and 1 other location - About 6 hrs to fix
            src_aurelia-bodylight-plugin/src/elements/animate-adobe-ss.js on lines 253..259

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

            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

              removeScript(source) {
                let src = window.bdlBaseHref ? window.bdlBaseHref + source : source;
                let tags = document.getElementsByTagName('script');
                for (let i = tags.length; i >= 0; i--) { //search backwards within nodelist for matching elements to remove
                  if (tags[i] && tags[i].getAttribute('src') !== null && tags[i].getAttribute('src').indexOf(src) !== -1) {tags[i].parentNode.removeChild(tags[i]);} //remove element by calling parentNode.removeChild()
            src_aurelia-bodylight-plugin/src/elements/animate-adobe.js on lines 210..216

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

            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

              flushRealQueue() {
                if (this.setRealQueue) {
                  const referenceBuffer = this.createAndFillBuffer(new Int32Array(this.setRealQueue.references));
                  const references = this.viewBuffer(referenceBuffer);
                  const valueBuffer = this.createAndFillBuffer(new Float64Array(this.setRealQueue.values));
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/fmi.js and 1 other location - About 6 hrs to fix
            src_aurelia-bodylight-plugin/src/elements/fmi.js on lines 897..910

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

            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

              flushBooleanQueue() {
                if (this.setBooleanQueue) {
                  const referenceBuffer = this.createAndFillBuffer(new Int32Array(this.setBooleanQueue.references));
                  const references = this.viewBuffer(referenceBuffer);
                  const valueBuffer = this.createAndFillBuffer(new Int32Array(this.setBooleanQueue.values));
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/fmi.js and 1 other location - About 6 hrs to fix
            src_aurelia-bodylight-plugin/src/elements/fmi.js on lines 882..895

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

            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

            Severity
            Category
            Status
            Source
            Language