creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

File dygraph.js has 5651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */
/**
 * @license
 * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
 * MIT-licensed (http://opensource.org/licenses/MIT)
Severity: Major
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 2 wks to fix

    Function _renderLineChart has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring.
    Open

    DygraphCanvasRenderer.prototype._renderLineChart = function() {
        // TODO(danvk): use this.attr_ for many of these.
        var ctx = this.elementContext;
        var fillAlpha = this.attr_('fillAlpha');
        var errorBars = this.attr_("errorBars") || this.attr_("customBars");
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 2 days 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 bodylightFootnotePlugin has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring.
    Open

    export function bodylightFootnotePlugin(md) {
      let parseLinkLabel = md.helpers.parseLinkLabel;
      let isSpace = md.utils.isSpace;
    
      md.renderer.rules.footnote_ref          = renderFootnoteRef;
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/markdown-it-bfootnote.js - About 2 days 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

        if (this.type === 'match') {
          //prepare randomterms and randomanswers
          let indices1 = [...Array(this.terms_array.length).keys()];
          let indices2 = [...Array(this.answers_array.length).keys()];
          let shuffled1indices = _.shuffle(indices1);
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/quizx.js and 1 other location - About 2 days to fix
    src_aurelia-bodylight-plugin/src/elements/quiz.js on lines 42..62

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

    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.type === 'match') {
          //prepare randomterms and randomanswers
          let indices1 = [...Array(this.terms_array.length).keys()];
          let indices2 = [...Array(this.answers_array.length).keys()];
          let shuffled1indices = _.shuffle(indices1);
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/quiz.js and 1 other location - About 2 days to fix
    src_aurelia-bodylight-plugin/src/elements/quizx.js on lines 46..66

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

    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.convertors) {
          let convertvalues = this.convertors.split(';');
          let identity = x => x;
          this.operation = [];
          for (let i = 0; i < convertvalues.length; i++) {
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/chartjs.js and 1 other location - About 2 days to fix
    src_aurelia-bodylight-plugin/src/elements/dygraphchart.js on lines 112..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 364.

    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.convertors) {
              let convertvalues = this.convertors.split(';');
              let identity = x => x;
              this.operation = [];
              for (let i = 0; i < convertvalues.length; i++) {
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/dygraphchart.js and 1 other location - About 2 days to fix
    src_aurelia-bodylight-plugin/src/elements/chartjs.js on lines 129..158

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

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

    Dygraph.prototype.rollingAverage = function(originalData, rollPeriod) {
        if (originalData.length < 2)
            return originalData;
        rollPeriod = Math.min(rollPeriod, originalData.length);
        var rollingData = [];
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 day 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 numericTicks has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.numericTicks = function (a, b, pixels, opts, dygraph, vals) {
        //console.log("nt a " + a + " b " + b + " vals " + vals);
        var pixels_per_tick = opts('pixelsPerLabel');
        var ticks = [];
        var i, j, tickV, nTicks;
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 day 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 Legend has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.Plugins.Legend = (function() {
    
        /*
    
    Current bits of jankiness:
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 day 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 gatherDatasets_ has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) {
        var boundaryIds = [];
        var cumulative_y = [];  // For stacked series.
        var datasets = [];
        var extremes = {};  // series name -> [low, high]
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 day 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

    File fmi.js has 721 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {bindable,observable} from 'aurelia-framework';
    import _ from 'lodash';
    
    export const thirdpartytimeout = 5000;
    
    
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/fmi.js - About 1 day to fix

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

      export default class ElementGenerator {
        constructor(project, options, ui) {
          this.project = project;
          this.options = options;
          this.ui = ui;
      Severity: Major
      Found in aurelia_project/generators/element.js and 1 other location - About 1 day to fix
      src_aurelia-bodylight-plugin/aurelia_project/generators/element.js on lines 5..49

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

      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

      export default class ElementGenerator {
        constructor(project, options, ui) {
          this.project = project;
          this.options = options;
          this.ui = ui;
      aurelia_project/generators/element.js on lines 5..49

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

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

        bind() {
          //console.log('chartjs bind');
          if (typeof this.displayxticks === 'string') this.displayxticks = this.displayxticks === 'true'; 
          if ((typeof this.refindex == 'string') && (this.refindex.indexOf(',')>0)) { this.refindices = this.refindex.split(',')}
          else {
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/chartjs.js - About 1 day 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

        checkTermAnswerMatch(){
          if (this.selectedAnswer.index == this.selectedTerm.index) {
            this.selectedTerm.class = this.correct+' '+this.correctcolors[this.selectedAnswer.index]; 
            this.selectedAnswer.class=  this.correct+' '+this.correctcolors[this.selectedAnswer.index];
            this.selectedTerm.disabled = true;
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/quiz.js and 1 other location - About 1 day to fix
      src_aurelia-bodylight-plugin/src/elements/quizx.js on lines 190..204

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

      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

        checkTermAnswerMatch(){
          if (this.selectedAnswer.index == this.selectedTerm.index) {
            this.selectedTerm.class = this.correct+' '+this.correctcolors[this.selectedAnswer.index]; 
            this.selectedAnswer.class=  this.correct+' '+this.correctcolors[this.selectedAnswer.index];
            this.selectedTerm.disabled = true;
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/quizx.js and 1 other location - About 1 day to fix
      src_aurelia-bodylight-plugin/src/elements/quiz.js on lines 153..167

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

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

      DygraphCanvasRenderer.prototype._renderAxis = function() {
          if (!this.attr_('drawXAxis') && !this.attr_('drawYAxis')) return;
      
          // Round pixels to half-integer boundaries for crisper drawing.
          function halfUp(x)  { return Math.round(x) + 0.5; }
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 day 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 computeYAxisRanges_ has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
      Open

      Dygraph.prototype.computeYAxisRanges_ = function (extremes) {
          // Build a map from axis number -> [list of series names]
          var seriesForAxis = [], series;
          for (series in this.seriesToAxisMap_) {
              if (!this.seriesToAxisMap_.hasOwnProperty(series)) continue;
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 day 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 10 locations. Consider refactoring.
      Open

      export default class AttributeGenerator {
        constructor(project, options, ui) {
          this.project = project;
          this.options = options;
          this.ui = ui;
      Severity: Major
      Found in aurelia_project/generators/attribute.js and 9 other locations - About 1 day to fix
      aurelia_project/generators/binding-behavior.js on lines 5..41
      aurelia_project/generators/generator.js on lines 5..72
      aurelia_project/generators/task.js on lines 5..40
      aurelia_project/generators/value-converter.js on lines 5..41
      src_aurelia-bodylight-plugin/aurelia_project/generators/attribute.js on lines 5..44
      src_aurelia-bodylight-plugin/aurelia_project/generators/binding-behavior.js on lines 5..41
      src_aurelia-bodylight-plugin/aurelia_project/generators/generator.js on lines 5..72
      src_aurelia-bodylight-plugin/aurelia_project/generators/task.js on lines 5..40
      src_aurelia-bodylight-plugin/aurelia_project/generators/value-converter.js on lines 5..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 250.

      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

      Severity
      Category
      Status
      Source
      Language