creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

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

    constructor(){
        super();
        this.handleValueChange = e => {
            //let j = this.currentdataset;
            //all values from refindex to one dataset - as one curve
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function handleResize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    handleResize() {
      console.log('animateadobe handleResize()');
      //do not run if ani.lib is not defined - no adobe component is available
      if (!window.ani.lib) return;
      let w = window.ani.lib.properties.width; let h = window.ani.lib.properties.height;
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

        if (this.chart.data.datasets[j].data.length > this.maxdata) {
          //console.log('shifting dataset chartjs-xy', this.chart.data.datasets[j].data);
          this.chart.data.datasets[j].data.shift();
        }
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy.js and 1 other location - About 1 hr to fix
src_aurelia-bodylight-plugin/src/elements/chartjs-pv.js on lines 22..25

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

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 (this.chart.data.datasets[j].data.length > this.maxdata) {
          //console.log('shifting dataset chartjs-xy', this.chart.data.datasets[j].data);
          this.chart.data.datasets[j].data.shift();
        }
Severity: Major
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-pv.js and 1 other location - About 1 hr to fix
src_aurelia-bodylight-plugin/src/elements/chartjs-xy.js on lines 30..33

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

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

    attached() {
      //register horizontal line drawing, shows difference line between appropriate points from dataset0 and dataset1
      Chart.pluginService.register({
        beforeDraw: function(chart, ease) {
          if (chart.config.options.XYPlugin && chart.tooltip._active && chart.tooltip._active.length) {
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-points.js - About 1 hr to fix

    Function handleValueChange has 46 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
                //if (!this.chart.data.datasets[j]) {
                    //do initialize dataset first
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/elements/chartjs-fixed.js - About 1 hr to fix

      Function createRotatedDiv has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function createRotatedDiv(axis, classes, html) {
              var box = {
                  left: 0,
                  top: that.area.y,
                  width: that.attr_('yLabelWidth'),
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

        Function startPan has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Dygraph.Interaction.startPan = function(event, g, context) {
            var i, axis;
            context.isPanning = true;
            var xRange = g.xAxisRange();
            context.dateRange = xRange[1] - xRange[0];
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

          Function render has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          DygraphCanvasRenderer.prototype.render = function() {
              // Draw the new X/Y grid. Lines appear crisper when pixels are rounded to
              // half-integers. This prevents them from drawing in two rows/cols.
              var ctx = this.elementContext;
              function halfUp(x)  { return Math.round(x) + 0.5; }
          Severity: Minor
          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

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

              constructor() {
                this.params = '';
                console.log('WatchhashCore');
                //event listener function needs to be declared this way - they have access to 'this'
                this.handleHashChange = e => {
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/attributes/watch-hash-core.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                static parse(uuid) {
                    var _a, _b, _c, _d;
                    let hex = undefined;
                    switch (uuid.length) {
                        case 32:
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/uuidv7.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                attached() {
                  //register horizontal line drawing, shows difference line between appropriate points from dataset0 and dataset1
                  Chart.pluginService.register({
                    beforeDraw: function(chart, ease) {
                      if (chart.config.options.XYPlugin && chart.tooltip._active && chart.tooltip._active.length) {
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-points.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function initdygraph has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                initdygraph() {
                    console.log('sachart - initdygraph');
                    if (this.pH >0) this.data = [[this.pH, this.pCO2]];
                    else this.data = [];
                    this.xaxis = "pH";
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/sachart.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                        if (this.refindex) {
                            let rawdata = e.detail.data[this.refindex];
                            this.value = this.operation[0](rawdata);
                            //  else this.value = rawdata;
                            //console.log('Range received rawdata '+rawdata+' converted value '+this.value);
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/range-smooth2.js and 1 other location - About 1 hr to fix
            src_aurelia-bodylight-plugin/src/elements/range.js on lines 38..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 70.

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

              bind() {
                //console.log('bdlmarkdownnav src:', this.src);
                if (this.notinitread && this.src && this.src.length > 0 && this.mdtoc) this.fetchMDSrc();
                //bind navigation first - get src before content - to solve navigation hide open issue at the beginning
                //console.log('bdlmakrdownnav src:', this.src);
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/markdownnav.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                            if (this.refindex) {
                                let rawdata = e.detail.data[this.refindex];
                                this.value = this.operation[0](rawdata);
                                //  else this.value = rawdata;
                                //console.log('Range received rawdata '+rawdata+' converted value '+this.value);
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/range.js and 1 other location - About 1 hr to fix
            src_aurelia-bodylight-plugin/src/elements/range-smooth2.js on lines 39..46

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

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

                legend.prototype.activate = function(g) {
                    var div;
                    var divWidth = g.getOption('labelsDivWidth');
            
                    var userLabelsDiv = g.getOption('labelsDiv');
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

              Function generateLegendDashHTML has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var generateLegendDashHTML = function(strokePattern, color, oneEmWidth) {
                      // IE 7,8 fail at these divs, so they get boring legend, have not tested 9.
                      var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera);
                      if (isIE) return "—";
              
              
              Severity: Minor
              Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

                Function attached has 43 lines of code (exceeds 25 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 1 hr to fix

                  Function initAdobe has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      initAdobe() {
                        console.log('animateadobe initAdobe()');
                        //search for composition which has the 'name' in library
                        for (let cid of Object.keys(window.AdobeAn.compositions)) {
                          let comp = window.AdobeAn.getComposition(cid);
                  Severity: Minor
                  Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language