creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

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

    if (args[i] === '--env' && i < ii - 1) {
      const env = args[++i].toLowerCase();
      if (env.startsWith('prod')) {
        cleaned.push('--env.production');
      } else if (env.startsWith('test')) {
Severity: Major
Found in aurelia_project/tasks/run.js and 1 other location - About 2 hrs to fix
aurelia_project/tasks/build.js on lines 14..23

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

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

    if (args[i] === '--env' && i < ii - 1) {
      const env = args[++i].toLowerCase();
      if (env.startsWith('prod')) {
        cleaned.push('--env.production');
      } else if (env.startsWith('test')) {
Severity: Major
Found in aurelia_project/tasks/build.js and 1 other location - About 2 hrs to fix
aurelia_project/tasks/run.js on lines 20..31

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

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 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_aurelia-bodylight-plugin/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 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_aurelia-bodylight-plugin/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 addAnswer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    addAnswer(qid2,answer){
        let qid = qid2;
        if (qid2.includes(';')) qid = qid2.split(';')[0]; //first is id second is id of related tabs
        if (this.quizids.includes(qid2)) {
            let item = this.qas.find(item => item.id === qid);
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.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 initAdobe has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    initAdobe() {
      console.log('animateadobe initAdobe()');
      //search for composition which has the 'name' in library
      for (let cid of Object.keys(window.AdobeAn.compositions)) {
        let comp = window.AdobeAn.getComposition(cid);
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.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

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

      } else {    
        //go with toPrecision function
        if (this.operation) this.value = this.operation[0](rawvalue).toPrecision(this.precision); // * this.numerator / this.denominator + this.addconst;
        else this.value = rawvalue.toPrecision(this.precision);
      }
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/value.js and 1 other location - About 2 hrs to fix
src_aurelia-bodylight-plugin/src/elements/value.js on lines 121..125

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      if ((this.tofixed !== null) && (this.tofixed !== undefined) && (this.tofixed>=0)) {
        //probably will have toFixed function
        if (this.operation) this.value = this.operation[0](rawvalue).toFixed(this.tofixed); // * this.numerator / this.denominator + this.addconst;
        else this.value = rawvalue.toFixed(this.tofixed);
      } else {    
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/value.js and 1 other location - About 2 hrs to fix
src_aurelia-bodylight-plugin/src/elements/value.js on lines 125..129

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

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 _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_aurelia-bodylight-plugin/src/utils/dygraph.js - About 2 hrs to fix

    File fb-config.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * firebase configuration
     * subscribe to fb-get-message channel to get broadcasted messages from firebase
     * send message to fb-send-message channel to sned the message to firebase
     */
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/fb-config.js - About 2 hrs to fix

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

        initfmi() {
          console.log('fmi initfmi()');
          let that = {};
          /* global/local fminame */
          
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/fmi.js - About 1 hr 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_aurelia-bodylight-plugin/src/elements/chartjs-fixed.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_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

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

                async bind() {
                    let firebaseConfig;
                    console.log('FBconfig.bind()');
                    if (!window.userid) {
                        let storeduuid = localStorage.getItem('deviceUUID');
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/fb-config.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_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 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_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 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_aurelia-bodylight-plugin/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 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_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 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_aurelia-bodylight-plugin/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 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();
                  //read input values
              Severity: Minor
              Found in src_aurelia-bodylight-plugin/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