creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

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

    attached () {
        if (this.showrefpoint) {
            document.addEventListener('xdata',this.handleXData);
            window.refpoint=0;
            Chart.pluginService.register({
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-time.js - About 1 hr to fix

    Function parseArray_ has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Dygraph.prototype.parseArray_ = function(data) {
        // Peek at the first x value to see if it's numeric.
        if (data.length === 0) {
            this.error("Can't plot empty data set");
            return null;
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

      Function findStackedPoint has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Dygraph.prototype.findStackedPoint = function(domX, domY) {
          var row = this.findClosestRow(domX);
          var boundary = this.getLeftBoundary_();
          var rowIdx = row - boundary;
          var points = this.layout_.points;
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

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

          Function refresh has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          let refresh = debounce(() => {
            if (isBuilding) {
              log('Watcher: A build is already in progress, deferring change detection...');
              return;
            }
          Severity: Minor
          Found in src_aurelia-bodylight-plugin/aurelia_project/tasks/watch.js - About 1 hr to fix

            Function _dashedLine has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            DygraphCanvasRenderer.prototype._dashedLine = function(ctx, x, y, x2, y2, pattern) {
                // Original version http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas
                // Modified by Russell Valentine to keep line history and continue the pattern
                // where it left off.
                var dx, dy, len, rot, patternIndex, segment;
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

              Function constructor has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor() {
                  super();    
                  this.customBackgroundPlugin = {
                    beforeDatasetsDraw: function(chart, easing) {
                      const acidbaseannotation = [[7.4,40,"Normal area"],
              Severity: Minor
              Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-sachart.js - About 1 hr to fix

                Function beforeDraw has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        beforeDraw: function(chart, ease) {
                          if (chart.config.options.XYPlugin && chart.tooltip._active && chart.tooltip._active.length) {
                            let activePoint = chart.tooltip._active[0];
                            //console.log('chart horizontal line debug chart activepoint:', activePoint);
                            let ctx = chart.ctx;
                Severity: Minor
                Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy-points.js - About 1 hr to fix

                  Function registerInputs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    registerInputs(){
                      if (this.inputs) { //register DOM elements to listen to their 'change' event directly
                        let inputparts = this.inputs.split(';'); //splits groups delimited by ;
                        this.inputreferences = [];
                        for (let inputpart of inputparts) {
                  Severity: Minor
                  Found in src_aurelia-bodylight-plugin/src/elements/fmi.js - About 1 hr to fix

                    Function beforeDraw has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            beforeDraw: function(chart, easing) {
                              if (chart.config.options.section && chart.config.options.section.length > 0) {
                                let ctx = chart.chart.ctx;
                                let chartArea = chart.chartArea;
                                let meta = chart.getDatasetMeta(0);
                    Severity: Minor
                    Found in src_aurelia-bodylight-plugin/src/elements/chartjs.js - About 1 hr to fix

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

                          if (this.controlid) {
                            document.getElementById(this.controlid).addEventListener('fmistart', this.handleStart);
                            document.getElementById(this.controlid).addEventListener('fmistop', this.handleStop);
                          }
                      Severity: Major
                      Found in src_aurelia-bodylight-plugin/src/elements/fmi.js and 1 other location - About 1 hr to fix
                      src_aurelia-bodylight-plugin/src/elements/fmi.js on lines 373..376

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

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

                        attached() {
                          //listening to custom event fmidata
                          console.log('dygraph attached');
                          if (this.refindex && (this.refindex.indexOf(',')>0)) this.refindices = this.refindex.split(',');
                          let fmielement = document.getElementById(this.fromid);
                      Severity: Minor
                      Found in src_aurelia-bodylight-plugin/src/elements/dygraphchart.js - About 1 hr to fix

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

                            if (this.controlid) {
                              document.getElementById(this.controlid).removeEventListener('fmistart', this.handleStart);
                              document.getElementById(this.controlid).removeEventListener('fmistop', this.handleStop);
                            }
                        Severity: Major
                        Found in src_aurelia-bodylight-plugin/src/elements/fmi.js and 1 other location - About 1 hr to fix
                        src_aurelia-bodylight-plugin/src/elements/fmi.js on lines 203..206

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

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

                        Dygraph.Interaction.moveTouch = function(event, g, context) {
                            var i, touches = [];
                            for (i = 0; i < event.touches.length; i++) {
                                var t = event.touches[i];
                                touches.push({
                        Severity: Minor
                        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 cleanArgs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function cleanArgs(args) {
                          let host;
                          const cleaned = [];
                        
                          for (let i = 0, ii = args.length; i < ii; i++) {
                        Severity: Minor
                        Found in aurelia_project/tasks/run.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 createDragInterface_ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                        Dygraph.prototype.createDragInterface_ = function() {
                            var context = {
                                // Tracks whether the mouse is down right now
                                isZooming: false,
                                isPanning: false,  // is this drag part of a pan?
                        Severity: Minor
                        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.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 processValue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          processValue(value) {
                            //compare with current segment condition
                            //do stop simulation if the condition in 'relation' is met - returns true
                            let referencevalue = this.segmentconditions[this.currentsegment].value;
                            if (this.segmentconditions[this.currentsegment].relation(value, referencevalue)) {
                        Severity: Minor
                        Found in src_aurelia-bodylight-plugin/src/elements/animate-control.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 drawMiniPlot_ has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        DygraphRangeSelector.prototype.drawMiniPlot_ = function() {
                            var fillStyle = this.attr_('rangeSelectorPlotFillColor');
                            var strokeStyle = this.attr_('rangeSelectorPlotStrokeColor');
                            if (!fillStyle && !strokeStyle) {
                                return;
                        Severity: Minor
                        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

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

                            Function binarySearch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            Dygraph.binarySearch = function(val, arry, abs, low, high) {
                                if (low === null || low === undefined ||
                                    high === null || high === undefined) {
                                    low = 0;
                                    high = arry.length - 1;
                            Severity: Minor
                            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language