creative-connections/aurelia-bodylight-plugin

View on GitHub

Showing 552 of 552 total issues

Function computeCombinedSeriesAndLimits_ has a Cognitive Complexity of 65 (exceeds 5 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: Minor
Found in 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 parseCSV_ has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

Dygraph.prototype.parseCSV_ = function(data) {
    var ret = [];
    var lines = data.split("\n");
    var vals, j;

Severity: Minor
Found in 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 parseDataTable_ has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

Dygraph.prototype.parseDataTable_ = function(data) {
    var shortTextForAnnotationNum = function(num) {
        // converts [0-9]+ [A-Z][a-z]*
        // example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab
        // and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz
Severity: Minor
Found in 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 initInteraction_ has 227 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DygraphRangeSelector.prototype.initInteraction_ = function() {
    var self = this;
    var topElem = this.isIE_ ? document : window;
    var xLast = 0;
    var handle = null;
Severity: Major
Found in src/utils/dygraph.js - About 1 day to fix

    Function RGBColor has 218 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function RGBColor(color_string)
    {
        this.ok = false;
    
        // strip any leading #
    Severity: Major
    Found in src/utils/dygraph.js - About 1 day to fix

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

          if (this.min) {
            //sets yscale min
            if (!this.options) this.options = {};
            if (!this.options.scales) this.options.scales = {};
            if (!this.options.scales.yAxes) this.options.scales.yAxes = [{}]; //chartjs 2.9.4
      Severity: Major
      Found in src/elements/chartjs.js and 1 other location - About 1 day to fix
      src/elements/chartjs-xy-points.js on lines 49..56

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

      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.xmin) {
              //sets yscale min
              if (!this.options) this.options = {};
              if (!this.options.scales) this.options.scales = {};
              if (!this.options.scales.xAxes) this.options.scales.xAxes = [{}]; //chartjs 2.9.4
      Severity: Major
      Found in src/elements/chartjs-xy-points.js and 1 other location - About 1 day to fix
      src/elements/chartjs.js on lines 294..301

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

      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 bodylightFootnotePlugin has 210 lines of code (exceeds 25 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: Major
      Found in src/elements/markdown-it-bfootnote.js - About 1 day to fix

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

              if (this.xmax) {
                //sets yscale max
                if (!this.options) this.options = {};
                if (!this.options.scales) this.options.scales = {};
                if (!this.options.scales.xAxes) this.options.scales.xAxes = [{}]; //chartjs 2.9.4
        Severity: Major
        Found in src/elements/chartjs-xy-points.js and 1 other location - About 1 day to fix
        src/elements/chartjs.js on lines 302..310

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

        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.max) {
              //sets yscale max
              if (!this.options) this.options = {};
              if (!this.options.scales) this.options.scales = {};
              if (!this.options.scales.yAxes) this.options.scales.yAxes = [{}]; //chartjs 2.9.4
        Severity: Major
        Found in src/elements/chartjs.js and 1 other location - About 1 day to fix
        src/elements/chartjs-xy-points.js on lines 57..65

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

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

            bind() {
                if (typeof (this.smooth) === 'string') this.smooth = this.smooth === 'true';
                if (typeof (this.step) === 'string') this.step = parseFloat(this.step);
                if (typeof (this.showicons) === 'string') this.showicons = this.showicons === 'true';
                if (typeof (this.globalanim) === 'string') this.globalanim = this.globalanim === 'true';
        Severity: Minor
        Found in src/elements/range.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 updatetitles has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
        Open

          updatetitles(hashstruct) {
              //this.currentlink
              console.log('top nav hash:', hashstruct);
              if (window.markdownnav) {
                let currentlink = '#' + (hashstruct[0].length > 0 ? hashstruct[0] : this.index);
        Severity: Minor
        Found in src/elements/markdown-top-nav.js - About 7 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 Legend has 181 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Dygraph.Plugins.Legend = (function() {
        
            /*
        
        Current bits of jankiness:
        Severity: Major
        Found in src/utils/dygraph.js - About 7 hrs to fix

          Function attached has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
          Open

            attached() {
              //console.log('chartjs attached');
              //listening to custom event fmidata and fmireset
              const fromel = document.getElementById(this.fromid);
              if (fromel) {
          Severity: Minor
          Found in src/elements/chartjs.js - About 6 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

          File chartjs.js has 451 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import Chart from 'chart.js';
          import ChartDataLabels from 'chartjs-plugin-datalabels';
          import {bindable} from 'aurelia-framework';
          import _ from 'lodash';
          
          
          Severity: Minor
          Found in src/elements/chartjs.js - About 6 hrs to fix

            Fmi has 48 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class Fmi {
              @bindable fminame='N/A';
              @bindable tolerance=0.000001;//0.000030517578
              @bindable starttime=0;
              @bindable stoptime=0; //if >0 then fmi will stop at stoptime
            Severity: Minor
            Found in src/elements/fmi.js - About 6 hrs to fix

              Function _renderLineChart has 162 lines of code (exceeds 25 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: Major
              Found in src/utils/dygraph.js - About 6 hrs to fix

                Function _drawSeries has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                Open

                DygraphCanvasRenderer.prototype._drawSeries = function(
                    ctx, iter, strokeWidth, pointSize, drawPoints, drawGapPoints,
                    stepPlot, strategy) {
                
                    var prevCanvasX = null;
                Severity: Minor
                Found in src/utils/dygraph.js - About 6 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 computeYAxes_ has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                Open

                Dygraph.prototype.computeYAxes_ = function() {
                    // Preserve valueWindow settings if they exist, and if the user hasn't
                    // specified a new valueRange.
                    var i, valueWindows, seriesName, axis, index, opts, v;
                    if (this.axes_ !== undefined && this.user_attrs_.hasOwnProperty("valueRange") === false) {
                Severity: Minor
                Found in src/utils/dygraph.js - About 6 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 getDateAxis has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                Open

                Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
                    var formatter = opts("axisLabelFormatter");
                    var ticks = [];
                    var t;
                
                
                Severity: Minor
                Found in src/utils/dygraph.js - About 6 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