creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

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

            let newdataset = {
                data: data,
                label: "",
                backgroundColor: this.currentcolor,
                borderColor: this.currentcolor,
src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.js on lines 132..141

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

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

    mouseup: function(event, g, context) {
        if (context.isZooming) {
            Dygraph.endZoom(event, g, context);
        } else if (context.isPanning) {
            Dygraph.endPan(event, g, context);
Severity: Major
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 1 hr to fix
src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 6794..6800

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

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 configure has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function configure(aurelia) {
    aurelia.use
        .standardConfiguration()
        //all components from src (resources/index) will be registered as web component
        .plugin(PLATFORM.moduleName('aurelia-bodylight-plugin'))
Severity: Minor
Found in src_webcomponents/webcomponents.js - About 1 hr to fix

    Function updateOptions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) {
        if (typeof(block_redraw) == 'undefined') block_redraw = false;
    
        // mapLegacyOptions_ drops the "file" parameter as a convenience to us.
        var file = input_attrs.file;
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

      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 constructor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            constructor() {
                super();
                this.handleXData  = e => {
                    window.refpoint = e.target.value;
                    this.updatechart();
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/elements/chartjs-time.js - About 1 hr to fix

          Function _drawStyledLine has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              ctx, i, setName, color, strokeWidth, strokePattern, drawPoints,
              drawPointCallback, pointSize) {
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

            Function bind has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                bind() {
                  super.bind();
                  if (this.type && this.type.startsWith('on.')) {
                    this.expand = true;
                    this.type = this.type.substring(3)
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/markdown-book2.js - About 1 hr to fix

              Function getScript has 28 lines of code (exceeds 25 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 1 hr to fix

                Function bind has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    bind(){
                        super.bind();
                        this.type = 'line';
                        this.options.legend.display = false;
                        let dataset = [];
                Severity: Minor
                Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed.js - About 1 hr to fix

                  Function handleValueChangeImpl has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    handleValueChangeImpl(e) {
                      console.log('bdl-ecg handlevaluechange e.detail', e.detail);
                      let mysegment = e.detail.segment;
                      let myreltime = e.detail.relativetime;
                  
                  
                  Severity: Minor
                  Found in src_aurelia-bodylight-plugin/src/elements/ecg.js - About 1 hr to fix

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

                            this.previoustitle = currentlinkindex < (window.markdownnav.links.length - 1) ? window.markdownnav.links[currentlinkindex + 1].title : '';
                    src_aurelia-bodylight-plugin/src/elements/markdown-bottom-nav.js on lines 60..60

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

                    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

                            this.previouslink = currentlinkindex < (window.markdownnav.links.length - 1) ? window.markdownnav.links[currentlinkindex + 1].url : '';
                    src_aurelia-bodylight-plugin/src/elements/markdown-bottom-nav.js on lines 59..59

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

                    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 < ydata.length; i++) {
                                    data.push({x: xdata[i], y: ydata[i]});
                                }
                    src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.js on lines 128..130

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

                    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

                          this.chart.data.datasets[0].datalabels.push(...(this.ecglabels[mysegment].slice(this.previousindex, this.index)));
                    Severity: Major
                    Found in src_aurelia-bodylight-plugin/src/elements/ecg.js and 1 other location - About 1 hr to fix
                    src_aurelia-bodylight-plugin/src/elements/ecg.js on lines 108..108

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

                    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 < y2data.length; i++) {
                                        datab.push({x: xdata[i], y: y2data[i]});
                                    }
                    src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.js on lines 66..68

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

                    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

                          this.chart.data.datasets[0].data.push(...(this.ecgvalues[mysegment].slice(this.previousindex, this.index)));
                    Severity: Major
                    Found in src_aurelia-bodylight-plugin/src/elements/ecg.js and 1 other location - About 1 hr to fix
                    src_aurelia-bodylight-plugin/src/elements/ecg.js on lines 109..109

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

                    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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    DygraphCanvasRenderer.prototype.render = function() {
                        // Draw the new X/Y grid. Lines appear crisper when pixels are rounded to
                        // half-integers. This prevents them from drawing in two rows/cols.
                        var ctx = this.elementContext;
                        function halfUp(x)  { return Math.round(x) + 0.5; }
                    Severity: Minor
                    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 _createIEClipArea has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    DygraphCanvasRenderer.prototype._createIEClipArea = function() {
                        var className = 'dygraph-clip-div';
                        var graphDiv = this.dygraph_.graphDiv;
                    
                        // Remove old clip divs.
                    Severity: Minor
                    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 doAnimatedZoom has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Dygraph.prototype.doAnimatedZoom = function(oldXRange, newXRange, oldYRanges, newYRanges, callback) {
                        var steps = this.attr_("animatedZooms") ? Dygraph.ANIMATION_STEPS : 1;
                    
                        var windows = [];
                        var valueRanges = [];
                    Severity: Minor
                    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

                    Severity
                    Category
                    Status
                    Source
                    Language