creative-connections/aurelia-bodylight-plugin

View on GitHub

Showing 552 of 552 total issues

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

      if (window.thisfmi.isOneshot) {
        console.log('oneshot scheduling direct(nopromise) to do step()')
        setTimeout(window.thisfmi.sendStartEvent.bind(window.thisfmi),1000)
        //setTimeout(window.thisfmi.shot.bind(window.thisfmi),1500);
        _.throttle(window.thisfmi.shot.bind(window.thisfmi),1500);
Severity: Major
Found in src/elements/fmi.js and 1 other location - About 2 hrs to fix
src/elements/fmi.js on lines 309..323

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

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

    this.handleFMIAttached = e => {
      const fromel = document.getElementById(this.fromid);
      if (fromel) {
        fromel.addEventListener('fmidata', this.handleValueChange);
      } else {
Severity: Major
Found in src/elements/value-store.js and 1 other location - About 2 hrs to fix
src/elements/value.js on lines 34..41

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

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

        setTimeout(() => {
          //let pdbeMolstarComponent = document.getElementById(this.pid);
          let viewerInstance = this.pdbref.viewerInstance;
          viewerInstance.visual.toggleSpin(true);
          if (this.showIons) viewerInstance.visual.select({data: this.selectIonsSection});
Severity: Major
Found in src/elements/pdb-pdbe-molstar.js and 1 other location - About 2 hrs to fix
src/elements/pdb-pdbe-molstar.js on lines 88..93

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

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

        setTimeout(() => {
          //let pdbeMolstarComponent = document.getElementById(this.pid);
          let viewerInstance = this.pdbref.viewerInstance;
          viewerInstance.visual.toggleSpin(true);
          if (this.showIons) viewerInstance.visual.select({data: this.selectIonsSection});
Severity: Major
Found in src/elements/pdb-pdbe-molstar.js and 1 other location - About 2 hrs to fix
src/elements/pdb-pdbe-molstar.js on lines 76..81

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

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

DygraphCanvasRenderer.prototype._createIEClipArea = function() {
    var className = 'dygraph-clip-div';
    var graphDiv = this.dygraph_.graphDiv;

    // Remove old clip divs.
Severity: Major
Found in src/utils/dygraph.js - About 2 hrs to fix

    Function updateOptions has a Cognitive Complexity of 16 (exceeds 5 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/utils/dygraph.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 parseArray_ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.parseArray_ = function(data) {
        // Peek at the first x value to see if it's numeric.
        if (data.length === 0) {
            this.error("Can't plot empty data set");
            return null;
    Severity: Minor
    Found in src/utils/dygraph.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 bind has 52 lines of code (exceeds 25 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: Major
    Found in src/elements/range.js - About 2 hrs to fix

      Function _drawSeries has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      DygraphCanvasRenderer.prototype._drawSeries = function(
          ctx, iter, strokeWidth, pointSize, drawPoints, drawGapPoints,
          stepPlot, strategy) {
      
          var prevCanvasX = null;
      Severity: Major
      Found in src/utils/dygraph.js - About 2 hrs to fix

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

          bind() {
            if (this.speedfactor) {
              if (typeof this.speedfactor === 'string') this.speedfactor = parseInt(this.speedfactor, 10);
              if (this.speedfactor <= 0 || this.speedfactor > 100) this.speedfactor = 100;
            }
        Severity: Minor
        Found in src/elements/animate-control.js - About 2 hrs to fix

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

              constructor(){
                  super();
                  this.handleValueChange = e => {
                      //let j = this.currentdataset;
                      //all values from refindex to one dataset - as one curve
          Severity: Minor
          Found in src/elements/chartjs-fixed.js - About 1 hr to fix

            Function initfmi has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              initfmi() {
                console.log('fmi initfmi()');
                let that = {};
                if (window.thisfmi) {
                  that.fminame = window.thisfmi.fminame;
            Severity: Minor
            Found in src/elements/fmi.js - About 1 hr to fix

              Function generateLegendHTML has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var generateLegendHTML = function(g, x, sel_points, oneEmWidth) {
                      // TODO(danvk): deprecate this option in place of {legend: 'never'}
                      if (g.getOption('showLabelsOnHighlight') !== true) return '';
              
                      // If no points are selected, we display a default legend. Traditionally,
              Severity: Minor
              Found in src/utils/dygraph.js - About 1 hr to fix

                Function _renderChartLabels has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                DygraphCanvasRenderer.prototype._renderChartLabels = function() {
                    var div, class_div;
                
                    // Generate divs for the chart title, xlabel and ylabel.
                    // Space for these divs has already been taken away from the charting area in
                Severity: Minor
                Found in 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 clear has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                DygraphCanvasRenderer.prototype.clear = function() {
                    var context;
                    if (this.isIE) {
                        // VML takes a while to start up, so we just poll every this.IEDelay
                        try {
                Severity: Minor
                Found in 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 setColors_ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                Dygraph.prototype.setColors_ = function() {
                    var num = this.attr_("labels").length - 1;
                    this.colors_ = [];
                    var colors = this.attr_('colors');
                    var i;
                Severity: Minor
                Found in 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 bind has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                  bind() {
                    //
                    let convertvalues = this.value.split(';');
                    let identity = x => x;
                    this.operation = [];
                Severity: Minor
                Found in src/attributes/value-convertor.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 handleResize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                  handleResize() {
                    console.log('animateadobe handleResize()');
                    //do not run if ani.lib is not defined - no adobe component is available
                    if (!this.lib) return;
                    let w = this.lib.properties.width; let h = this.lib.properties.height;
                Severity: Minor
                Found in src/elements/animate-adobe-ss.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 handleResize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    handleResize() {
                      console.log('animateadobe handleResize()');
                      //do not run if ani.lib is not defined - no adobe component is available
                      if (!window.ani.lib) return;
                      let w = window.ani.lib.properties.width; let h = window.ani.lib.properties.height;
                Severity: Minor
                Found in src/elements/animate-adobe.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 startSimulation has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                  startSimulation() {
                    this.animationstarted = true;
                    this.fpsInterval = 1000 / (isNaN(this.fpslimit) ? parseInt(this.fpslimit, 10) : this.fpslimit);
                    this.then = window.performance.now();
                    const performAnimation = (newtime) => {
                Severity: Minor
                Found in src/elements/fmi.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