creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

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

  constructor() {
    //create lambda function which is added as listener later
    this.changeinputs = {}; //[]; change to associative array
    this.handleValueChange = e => {
      //e.target; //triggered the event
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fmi.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 25 (exceeds 5 allowed). Consider refactoring.
Open

    bind() {
      super.bind();
      this.plugins = [ChartDataLabels];
      if (this.extremelimits) {
        this.elimits = this.extremelimits.split(','); //split by comma
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-barplot.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 gatherDatasets_ has 89 lines of code (exceeds 25 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: Major
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 hrs to fix

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

      selectAnswer(answer){ //in choice - answer was selected
        if (answer.disabled) return;
        if (this.selectedAnswer) {this.selectedAnswer.class= this.unselected;}
        this.selectedAnswer = answer;
        if (this.selectedTerm) {
    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 180..190

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

    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

      selectAnswer(answer){ //in choice - answer was selected
        if (answer.disabled) return;
        if (this.selectedAnswer) {this.selectedAnswer.class= this.unselected;}
        this.selectedAnswer = answer;
        if (this.selectedTerm) {
    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 217..226

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

    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.maxXindex === null) {
            this.maxXindex = 0;
            var x2 = arr[0][0]
            for (var maxi = 1; maxi < arr.length; maxi++){
                var elem = arr[maxi][0];
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 3 hrs to fix
    src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 2490..2500

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

    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.minXindex === null) {
            this.minXindex = 0;
            var x2 = arr[0][0]
            for (var maxi = 1; maxi < arr.length; maxi++){
                var elem = arr[maxi][0];
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 3 hrs to fix
    src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 2471..2481

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

    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 (indepType == 'date' || indepType == 'datetime') {
            this.attrs_.xValueParser = Dygraph.dateParser;
            this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
            this.attrs_.axes.x.ticker = Dygraph.dateTicker;
            this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 3 hrs to fix
    src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 4453..4466

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

    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 (isDate) {
            this.attrs_.xValueParser = Dygraph.dateParser;
            this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
            this.attrs_.axes.x.ticker = Dygraph.dateTicker;
            this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js and 1 other location - About 3 hrs to fix
    src_aurelia-bodylight-plugin/src/utils/dygraph.js on lines 4735..4749

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

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

    DygraphCanvasRenderer.prototype._renderAnnotations = function() {
        var annotationStyle = {
            "position": "absolute",
            "fontSize": this.attr_('axisLabelFontSize') + "px",
            "zIndex": 10,
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 3 hrs to fix

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

        Function movePan has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        Dygraph.Interaction.movePan = function(event, g, context) {
            context.dragEndX = g.dragGetX_(event, context);
            context.dragEndY = g.dragGetY_(event, context);
        
            var minDate = context.initialLeftmostDate -
        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 parseConvertors has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            parseConvertors() {
              //configure convertors - used to convert units received from fmi
              if (this.convertor) {
                let convertvalues = this.convertor.split(';');
                let identity = x => x;
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/elements/bind2a.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 markdownitbtoc has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        export function markdownitbtoc(md, _options) {
          // Set default options
          let options = Object.assign({}, defaultOptions, _options);
        
          // Global variables
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/elements/markdown-it-btoc.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

          selectTerm(term){
            if (term.disabled) return;
            if (this.selectedTerm) {this.selectedTerm.class = this.unselected;}
            this.selectedTerm = term;
            if (this.selectedAnswer) {
        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 169..178

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

        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

          selectTerm(term){
            if (term.disabled) return;
            if (this.selectedTerm) {this.selectedTerm.class = this.unselected;}
            this.selectedTerm = term;
            if (this.selectedAnswer) {
        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 206..215

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

        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.element &&
              this.element.au &&
              this.element.au.controller &&
              typeof (this.element.au.controller) === 'object' &&
              this.element.au.controller.viewModel &&
        src_aurelia-bodylight-plugin/src/attributes/fmu-index.js on lines 40..44

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

        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.element && this.element.au && this.element.au.controller && typeof (this.element.au.controller) === 'object' && this.element.au.controller.viewModel && typeof (this.element.au.controller.viewModel) === 'object') {
                this.elementVM = this.element.au.controller.viewModel;
                //check whether this.elementVM has changesrc function - to be called in event listener
                //this.isReadMDCustomElement = (typeof this.elementVM.changesrc === 'function');
            } else {console.warn('element viewmodel object doesnot exists, cant be called by handleXXX methods')}
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/attributes/fmu-index.js and 1 other location - About 3 hrs to fix
        src_aurelia-bodylight-plugin/src/attributes/value-convertor.js on lines 49..57

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

        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 23 (exceeds 5 allowed). Consider refactoring.
        Open

            bind() {
              super.bind();
              console.log('chartjs xy point bind()');
              if (this.xmin) {
                //sets yscale min
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-points.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

            for (let i = 0; i < this.answers_array.length; i++) {
              this.answer_exp_array.push(
                {
                  id: i,
                  answer: this.answers_array[i],
        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 35..44

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

        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