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 (!item) {
                let question = '';
                let qelement = document.getElementById(qid);
                if (qelement) question = qelement.getAttribute('question');
                console.log('adding default '+qid+' question '+question);
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.js and 1 other location - About 4 hrs to fix
src_aurelia-bodylight-plugin/src/elements/quiz-summary.js on lines 125..146

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

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 (index == -1) {
                let question = '';
                let qelement = document.getElementById(qid);
                if (qelement) question = qelement.getAttribute('question');
                console.log('adding default '+qid+' question '+question);
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.js and 1 other location - About 4 hrs to fix
src_aurelia-bodylight-plugin/src/elements/quiz-summary.js on lines 98..115

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

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 (!item) {
                let question = '';
                let qelement = document.getElementById(qid);
                if (qelement) question = qelement.getAttribute('question');
                console.log('adding default '+qid+' question '+question);
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.js and 1 other location - About 4 hrs to fix
src_aurelia-bodylight-plugin/src/elements/quiz-summary.js on lines 158..168

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

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

Dygraph.isPixelChangingOptionList = function(labels, attrs) {
    // A whitelist of options that do not change pixel positions.
    var pixelSafeOptions = {
        'annotationClickHandler': true,
        'annotationDblClickHandler': true,
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 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 processAnswers has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    processAnswers(data) {
        //const dbRef = ref(this.database, 'answers/');
        //dbRef.once('value', snapshot => {
        //const data = snapshot.val();
        let aggregatedResults = {}
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fb-config.js - About 3 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 a Cognitive Complexity of 27 (exceeds 5 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_aurelia-bodylight-plugin/src/elements/animate-control.js - About 3 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

    script.onload = script.onreadystatechange = function( _, isAbort ) {
      if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState) ) {
        script.onerror = script.onload = script.onreadystatechange = null;
        script = undefined;

src_aurelia-bodylight-plugin/src/elements/animate-adobe.js on lines 258..265

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

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

      script.onload = script.onreadystatechange = function( _, isAbort ) {
        if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState) ) {
          script.onerror = script.onload = script.onreadystatechange = null;
          script = undefined;

Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js and 1 other location - About 3 hrs to fix
src_aurelia-bodylight-plugin/src/elements/animate-adobe-ss.js on lines 189..196

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

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

DygraphRangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() {
    var data = this.dygraph_.rawData_;
    var logscale = this.attr_('logscale');

    // Create a combined series (average of all series values).
Severity: Major
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 hrs to fix

    Function constructor has 95 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: Major
    Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.js - About 3 hrs to fix

      Function markdownitbtoc has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function markdownitbtoc(md, _options) {
        // Set default options
        let options = Object.assign({}, defaultOptions, _options);
      
        // Global variables
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/markdown-it-btoc.js - About 3 hrs to fix

        Function _renderChartLabels has 94 lines of code (exceeds 25 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: Major
        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 hrs to fix

          Function updateSelection_ has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

          Dygraph.prototype.updateSelection_ = function(opt_animFraction) {
              var defaultPrevented = this.cascadeEvents_('select', {
                  selectedX: this.lastx_,
                  selectedPoints: this.selPoints_
              });
          Severity: Minor
          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 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 setSelection has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

          Dygraph.prototype.setSelection = function(row, opt_seriesName) {
              // Extract the points we've selected
              this.selPoints_ = [];
              var pos = 0;
          
          
          Severity: Minor
          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 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 26 (exceeds 5 allowed). Consider refactoring.
          Open

              attached() {
                  if (this.refpointindex) {
                      Chart.pluginService.register({
                          id: 'custom_lines to ref point',
                          afterDraw: (chart) => {
          Severity: Minor
          Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed.js - About 3 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

            submit() {
              //console.log('Bdlquis submit()');
              this.showresult = true;
              if (this.type === 'choice2') {
                if (this.selectedAnswer.correct) this.selectedAnswer.class = this.selectedcorrect;
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/elements/quizx.js and 1 other location - About 3 hrs to fix
          src_aurelia-bodylight-plugin/src/elements/quiz.js on lines 135..143

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

          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

            submit() {
              //console.log('Bdlquis submit()');
              this.showresult = true;
              if (this.type === 'choice2') {
                if (this.selectedAnswer.correct) this.selectedAnswer.class = this.selectedcorrect;
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/elements/quiz.js and 1 other location - About 3 hrs to fix
          src_aurelia-bodylight-plugin/src/elements/quizx.js on lines 172..180

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

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

                  this.handleValueChange = e => {
                      //let j = this.currentdataset;
                      //all values from refindex to one dataset - as one curve
                      let ydata = e.detail.data.slice(this.refindex, this.refindex + this.refvalues);
                      let y2data = [];
          Severity: Major
          Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed-xy.js - About 3 hrs to fix

            Function findStackedPoint has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            Dygraph.prototype.findStackedPoint = function(domX, domY) {
                var row = this.findClosestRow(domX);
                var boundary = this.getLeftBoundary_();
                var rowIdx = row - boundary;
                var points = this.layout_.points;
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 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 __init__ has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            Dygraph.prototype.__init__ = function (div, file, attrs) {
                // Hack for IE: if we're using excanvas and the document hasn't finished
                // loading yet (and hence may not have initialized whatever it needs to
                // initialize), then keep calling this routine periodically until it has.
                if (/MSIE/.test(navigator.userAgent) && !window.opera &&
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 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

            Severity
            Category
            Status
            Source
            Language