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

Dygraph.prototype.dragGetY_ = function(e, context) {
    return Dygraph.pageY(e) - context.py;
};
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 30 mins to fix
src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 2813..2815

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

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

      ? new CustomEvent(this.eventprefix + 'start', {detail: {time: this.frame, relativetime: this.relativeframe, segment: this.currentsegment}}) //send start signal on frame 0
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/animate-control.js and 1 other location - About 30 mins to fix
src_aurelia-bodylight-plugin/src/elements/animate-control.js on lines 184..184

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

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

Dygraph.compareArrays = function(array1, array2) {
    if (!Dygraph.isArrayLike(array1) || !Dygraph.isArrayLike(array2)) {
        return false;
    }
    if (array1.length !== array2.length) {
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

DygraphLayout.prototype._evaluateAnnotations = function() {
    // Add the annotations to the point to which they belong.
    // Make a map from (setName, xval) to annotation for quick lookups.
    var i;
    var annotations = {};
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

Dygraph.dateAxisFormatter = function(date, granularity) {
    if (granularity >= Dygraph.DECADAL) {
        return date.strftime('%Y');
    } else if (granularity >= Dygraph.MONTHLY) {
        return date.strftime('%b %y');
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

DygraphRangeSelector.prototype.drawInteractiveLayer_ = function() {
    var ctx = this.fgcanvas_ctx_;
    ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h);
    var margin = 1;
    var width = this.canvasRect_.w - margin;
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

Dygraph.prototype.findMaxXindex = function (arr) {
    if (this.maxXindex === null) {
        this.maxXindex = 0;
        var x2 = arr[0][0]
        for (var maxi = 1; maxi < arr.length; maxi++){
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

DygraphCanvasRenderer.isSupported = function(canvasName) {
    var canvas = null;
    try {
        if (typeof(canvasName) == 'undefined' || canvasName === null) {
            canvas = document.createElement("canvas");
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

Dygraph.prototype.findMinXindex = function (arr) {
    if (this.minXindex === null) {
        this.minXindex = 0;
        var x2 = arr[0][0]
        for (var maxi = 1; maxi < arr.length; maxi++){
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

Dygraph.prototype.extractSeries_ = function(rawData, i, logScale) {
    var series = [];
    for (var j = 0; j < rawData.length; j++) {
        var x = rawData[j][0];
        var point = rawData[j][i];
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

Dygraph.prototype.animateSelection_ = function(direction) {
    var totalSteps = 10;
    var millis = 30;
    if (this.fadeLevel === undefined) this.fadeLevel = 0;
    if (this.animateId === undefined) this.animateId = 0;
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

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

  bind() {
    this.paramname = [];
    this.paramindex = [];
    if (!this.params) return;
    console.log('watchhashcore.bind() params:', this.params);
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/attributes/watch-hash-core.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

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

DygraphRangeSelector.prototype.drawMiniPlot_ = function() {
    var fillStyle = this.attr_('rangeSelectorPlotFillColor');
    var strokeStyle = this.attr_('rangeSelectorPlotStrokeColor');
    if (!fillStyle && !strokeStyle) {
        return;
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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

Function bind has a Cognitive Complexity of 6 (exceeds 5 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 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

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

    changesrc(...args) {
      //super.changesrc(...args);
      if (args[0]) this.shownav = (args[0] !== 'false');
      if (args['shownav'])this.shownav = (args['shownav'] !== 'false');
      if (args[1]) this.showtoc = (args[1] !== 'false');
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/markdown-book2.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

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

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

    constructor(ea){
        this.ea =ea;
        //this is to register listener function - per aurelia docs -this needs to be done this way
        this.handleChange = e => {
            if (e.detail && e.detail.id) {
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/tabs.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

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

  attached() {
    //listening to custom event fmidata
    //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/value.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

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

  shot(e){
    console.log('fmi -> shot()')
    //check whether initialized and instantiated
    if (!this.inst) {
      //not instantiated
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fmi.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

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

  handleValue(animobj, value) {
    if (!this.triggered) {
      //not triggered - check if animation should start
      if (value > this.limit) {
        animobj.startAnimation(this.aname);
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/bind2animswitch.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

Severity
Category
Status
Source
Language