sicambria/skilltree

View on GitHub

Showing 537 of 537 total issues

Function getChildren has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function getChildren (skills, skill, children) {
    var temp = [];
    for (var i = 0; skill.children != undefined && i < skill.children.length; ++i) {
        var child = skills.find(obj => obj.name == skill.children[i].name);

Severity: Minor
Found in new design/draft_create_skill_modal_design/user/chartandtree.js - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                            if(this.response!=null)
                            for(var i=0;i<this.response.length;i++)
                            {
                                addRow("trainingsTable");

Severity: Major
Found in new design/draft_create_skill_modal_design/user/chartandtree.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (this.skills[j].achievedPoint < minPoint || child.lowAPParents != undefined) {
                                child.itemcontainer.disable();
    
                                if (child.lowAPParents === undefined) {
                                    child.lowAPParents = new Array();
    Severity: Major
    Found in public/user/classes/tree.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if(this.response!=null)
                                  for(var i=0;i<this.response.length;i++)
                                  {
                                      addRow("parentsTable");
      
      
      Severity: Major
      Found in new design/draft_create_skill_modal_design/user/chartandtree.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (skillList.options[j].text == children[i].name) skillList.remove(j);
        Severity: Major
        Found in public/user/chartandtree.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (this.skills[j].achievedPoint < minPoint || child.lowAPParents != undefined) {
                                      child.itemcontainer.disable();
          
                                      if (child.lowAPParents === undefined) {
                                          child.lowAPParents = new Array();
          Severity: Major
          Found in new design/draft_create_skill_modal_design/user/classes/tree.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (this.skills[i].itemcontainer.skillborder.endorsement != undefined) this.skills[i].itemcontainer.skillborder.endorsement.filters = [colorMatrixFilter];
            Severity: Major
            Found in new design/draft_create_skill_modal_design/user/classes/itemcontainer.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (confirm(text)) {
                                          skillsToAdd.push(this.response.skill);
                                          var option = document.createElement("option");
                                          option.text = this.response.skill.name;
                                          skillList.add(option);
              Severity: Major
              Found in public/user/chartandtree.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (globalSkill.offers.find(obj => obj.username == user.username) != undefined) {
                                            globalSkills.find(obj => obj.name == userSkill.name).offers = globalSkill.offers.filter(obj => obj.username != user.username);
                                        }
                Severity: Major
                Found in app.js - About 45 mins to fix

                  Function createTableRow has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          function createTableRow( data1, data2, data3, data4, data5, classname )
                  Severity: Minor
                  Found in new design/draft_create_skill_modal_design/user/classes/itemcontainer.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (this.response.success) showBottomAlert('success', "Password changed successfully!");
                                            else showBottomAlert("danger", "Wrong password!");
                    Severity: Major
                    Found in public/user/chartandtree.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (this.skills[i].itemcontainer.skillborder.endorsement != undefined) this.skills[i].itemcontainer.skillborder.endorsement.filters = null;
                      Severity: Major
                      Found in new design/draft_create_skill_modal_design/user/classes/itemcontainer.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if (skillMatrix[component][row + 1] == undefined) skillMatrix[component].push([]);
                        Severity: Major
                        Found in app.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (this.skills[i].itemcontainer.skillborder.endorsement != undefined) this.skills[i].itemcontainer.skillborder.endorsement.filters = null;
                          Severity: Major
                          Found in public/user/classes/itemcontainer.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    else if (displayObject.containsPoint) {
                                                        if (displayObject.containsPoint(point)) {
                                                            hit = displayObject.displayOrder;
                                                        }
                                                    }
                            Severity: Major
                            Found in new design/draft_create_skill_modal_design/user/pixi/pixi-layers.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (globalSkill.offers.find(obj => obj.username == user.username) == undefined) {
                                                          globalSkills.find(obj => obj.name == userSkill.name).offers.push({
                                                              username: user.username,
                                                              location: user.location,
                                                              teachingDay: user.teachingDay,
                              Severity: Major
                              Found in app.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                            if (displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) {
                                                                hit = displayObject.displayOrder;
                                                            }
                                Severity: Major
                                Found in new design/draft_create_skill_modal_design/user/pixi/pixi-layers.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if (row == 0) {
                                                          await addRowToComponent(skillMatrix, component);
                                                          skillMatrix[component][0].push(skillToInsert);
                                                          // console.log(skillToInsert.name + " added to root(skills child found in tree)"); // for debugging reasons
                                                          // this checks if the row found was the root level.
                                  Severity: Major
                                  Found in app.js - About 45 mins to fix

                                    Function getChildren has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function getChildren (skills, skill, children) {
                                        var temp = [];
                                        for (var i = 0; skill.children != undefined && i < skill.children.length; ++i) {
                                            var child = skills.find(obj => obj.name == skill.children[i].name);
                                    
                                    
                                    Severity: Minor
                                    Found in public/user/chartandtree.js - About 45 mins 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

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if (this.skills[i].itemcontainer.skillborder.endorsement != undefined) this.skills[i].itemcontainer.skillborder.endorsement.filters = [colorMatrixFilter];
                                    Severity: Major
                                    Found in public/user/classes/itemcontainer.js - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language