creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

Function drawZoomRect_ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

Dygraph.prototype.drawZoomRect_ = function(direction, startX, endX, startY,
                                           endY, prevDirection, prevEndX,
                                           prevEndY) {
    var ctx = this.canvas_ctx_;

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

    attached(){        
        this.subscription = this.ea.subscribe('fb-get-message', payload => {
            //this.sendMessage(payload)            
            this.value = payload;
            console.log('message was taken:',this.value)
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fb-get-state.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 bind has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    bind() {
        /*this.subscription3 = this.ea.subscribe('fb-process-answer-result', answers =>{
            console.log('answers to show:',answers);
        });*/
        
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.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 bind has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  bind() {
    super.bind();
    let datasets = [];
    let mydata1 = this.initialdata.split(';');
    //initialize x and y, x is first dataset, y is al the rest
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-xy.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 initfmi has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  initfmi() {
    console.log('fmi initfmi()');
    let that = {};
    /* global/local fminame */
    
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/fmi.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 getVariant has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    getVariant() {
        const n = this.bytes[8] >>> 4;
        if (n < 0) {
            throw new Error("unreachable");
        }
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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    constructor() {
        super();
        //stacked box contains data, each box in different dataset, group is
        this.handleValueChange = e => {
            for (let j = 0; j< this.refindices.length; j++) {
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/chartjs-stacked.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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  constructor() {
    super();
    //create lambda function which is added as listener later
    this.handleValueChange = e => {
      this.value = e.detail.data[this.refindex] * this.numerator / this.denominator;
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/trigger-on-increase.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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    constructor() {
        this.handleValueChange = e => {
            //sets data to dataset
            //apply value convert among all data
            if (this.fromid) {
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/range.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 destroyAdobe has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    destroyAdobe() {
      console.log('animate adobe destroy()');
      if (window.stage) {
        window.stage.enableMouseOver(-1);
        window.stage.enableDOMEvents(false);
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

Function bindhint has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  bindhint(qa){
    const answers = qa[this.id].a;
    for (const key of Object.keys(answers)) {
      const value = answers[key];      
      if (this.randomanswers) {
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/elements/quizx.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 updateDeep has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Dygraph.updateDeep = function (self, o) {
    // Taken from http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
    function isNode(o) {
        return (
            typeof Node === "object" ? o instanceof Node :
Severity: Minor
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

    Function findClosestPoint has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Dygraph.prototype.findClosestPoint = function(domX, domY) {
        var minDist = Infinity;
        var idx = -1;
        var points = this.layout_.points;
        var dist, dx, dy, point, closestPoint, closestSeries;
    Severity: Minor
    Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

      Function hsvToRGB has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Dygraph.hsvToRGB = function (hue, saturation, value) {
          var red;
          var green;
          var blue;
          if (saturation === 0) {
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

        Function destroy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Dygraph.prototype.destroy = function() {
            var removeRecursive = function(node) {
                while (node.hasChildNodes()) {
                    removeRecursive(node.firstChild);
                    node.removeChild(node.firstChild);
        Severity: Minor
        Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

          Function createZoomHandles_ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          DygraphRangeSelector.prototype.createZoomHandles_ = function() {
              var img = new Image();
              img.className = 'dygraph-rangesel-zoomhandle';
              img.style.position = 'absolute';
              img.style.zIndex = 10;
          Severity: Minor
          Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

            Function treatMouseOpAsClick has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) {
                var clickCallback = g.attr_('clickCallback');
                var pointClickCallback = g.attr_('pointClickCallback');
            
                var selectedPoint = null;
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 1 hr to fix

              Function updatetitles has 27 lines of code (exceeds 25 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_aurelia-bodylight-plugin/src/elements/markdown-top-nav.js - About 1 hr to fix

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

                          if (window.ani.stage) {
                            //TODO call removeEventListener and refactor adding listener when animation should start
                            if (!window.ani.animationstarted) window.ani.enableAnimation();//window.createjs.Ticker.addEventListener('tick', window.ani.stage);
                            window.ani.stage.play();
                          } else {
                Severity: Major
                Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js and 1 other location - About 1 hr to fix
                src_aurelia-bodylight-plugin/src/elements/animate-adobe.js on lines 523..539

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

                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 (window.ani.stage) {
                        //TODO call removeEventListener and refactor adding listener when animation should start
                        if (!window.ani.animationstarted) window.ani.enableAnimation();//window.createjs.Ticker.addEventListener('tick', window.ani.stage);
                        window.ani.stage.play();
                      } else {
                Severity: Major
                Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js and 1 other location - About 1 hr to fix
                src_aurelia-bodylight-plugin/src/elements/animate-adobe.js on lines 531..537

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

                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