sicambria/skilltree

View on GitHub

Showing 240 of 537 total issues

Function approveSkills has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function approveSkills() {
    hideMenus();

    var approveSkills = document.getElementById("approveSkills");

Severity: Minor
Found in new design/draft_offers_modal_design/user/chartandtree.js - About 1 hr to fix

    Function onClick has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        onClick(event) {
            if (!event.drag) {
                if (this.parentObj.self) {
                    var children = this.parentObj.skill.children;
    
    

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

    function editSkill () {
        document.getElementById('newSkillForm').reset();
    
        var modal = document.getElementById("newSkillModal");
        modal.style.display = "block";
    Severity: Minor
    Found in public/user/chartandtree.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 editSkill has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function editSkill () {
        document.getElementById('newSkillForm').reset();
    
        var modal = document.getElementById("newSkillModal");
        modal.style.display = "block";
    Severity: Minor
    Found in new design/draft_offers_modal_design/user/chartandtree.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 showTree has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function showTree (treeName, _data, self) {
        document.getElementById('creator').style.display = "none";
        document.getElementById('approveTrees').style.display = "none";
        document.getElementById('approveSkills').style.display = "none";
        document.getElementById('pixiCanvas').style.display = "block";
    Severity: Minor
    Found in new design/draft_create_skill_modal_design/user/src/display.js - About 1 hr to fix

      Function showTree has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function showTree (treeName, _data, self) {
          document.getElementById('creator').style.display = "none";
          document.getElementById('approveTrees').style.display = "none";
          document.getElementById('approveSkills').style.display = "none";
          document.getElementById('pixiCanvas').style.display = "block";
      Severity: Minor
      Found in public/user/src/display.js - About 1 hr to fix

        Function showTree has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function showTree (treeName, _data, self) {
            document.getElementById('creator').style.display = "none";
            document.getElementById('approveTrees').style.display = "none";
            document.getElementById('approveSkills').style.display = "none";
            document.getElementById('pixiCanvas').style.display = "block";
        Severity: Minor
        Found in new design/draft_offers_modal_design/user/src/display.js - About 1 hr to fix

          Function onClick has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              onClick(event) {
                  if (!event.drag) {
                      if (this.parentObj.self) {
                          var children = this.parentObj.skill.children;
          
          
          Severity: Minor
          Found in public/user/classes/itemcontainer.js - About 1 hr to fix

            Function onRightClick has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                onRightClick() {
                    if (this.parentObj.self) {
                        var children = this.parentObj.skill.children;
            
                        // Decrease skill level
            Severity: Minor
            Found in public/user/classes/itemcontainer.js - About 1 hr to fix

              Function refreshAvaliability has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  refreshAvaliability(){
                      for (var i = 0; i < this.skills.length; i++) {
                          for (var j = 0; j < this.skills[i].parents.length; j++) {
              
                              var par = this.skills.find(obj => obj.name == this.skills[i].parents[j]);
              Severity: Minor
              Found in public/user/classes/itemcontainer.js - About 1 hr to fix

                Function onDragMove has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    onDragMove(event) {
                        var obj = event.currentTarget;
                        if (!obj.dragging) return;
                        var data = obj.dragData;
                        if (obj.dragging == 1) {

                  Function onDragMove has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      onDragMove(event) {
                          var obj = event.currentTarget;
                          if (!obj.dragging) return;
                          var data = obj.dragData;
                          if (obj.dragging == 1) {

                    Function checkFirstLogin has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function checkFirstLogin() {
                        if (data.mainTree != undefined) startLoader();
                        else {
                            var modal = document.getElementById('firstLogin');
                            var btn = document.getElementById('savebtn');
                    Severity: Minor
                    Found in new design/draft_offers_modal_design/user/src/init.js - About 1 hr to fix

                      Function getPublicTreeData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function getPublicTreeData(){
                        var treeToSearch = {value: document.getElementById('cardSearchBar').value};
                        document.getElementById("searchModalTitle").innerHTML = "Click on a tree, to add it to your trees!";
                        request('POST', '/protected/getPublicTreeData', treeToSearch, function() {
                            if(this.readyState == 4 && this.status == 200) {
                      Severity: Minor
                      Found in public/user/src/search.js - About 1 hr to fix

                        Function switchSearch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function switchSearch(type){
                          document.getElementById('advSearchDetails').innerHTML = "";
                          if (type === "Skill") {
                            document.getElementById('cardSearchBar').onkeyup = function(){
                              if (Array.from(document.getElementById('skillSearchResult').options).find(obj => obj.value == document.getElementById('cardSearchBar').value) == undefined){
                        Severity: Minor
                        Found in public/user/src/search.js - About 1 hr to fix

                          Function insertSkill has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          async function insertSkill(skillToInsert, skillMatrix) {
                              for (var component = 0; component < skillMatrix.length; component++) {
                                  for (var child = 0; child < skillToInsert.children.length; child++) {
                                      for (var row = 0; row < skillMatrix[component].length; row++) {
                                          if ((skillMatrix[component][row].map(obj => obj.name)).includes(skillToInsert.children[child].name)) {
                          Severity: Minor
                          Found in app.js - About 1 hr to fix

                            Function validate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function validate() {
                                var loginBox = document.getElementById("loginBox");
                                var username = document.getElementById("username");
                                var password1 = document.getElementById("password1");
                                var password2 = document.getElementById("password2");
                            Severity: Minor
                            Found in public/register.js - About 1 hr to fix

                              Function getPublicTreeData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function getPublicTreeData(){
                                var treeToSearch = {value: document.getElementById('cardSearchBar').value};
                                document.getElementById("searchModalTitle").innerHTML = "Click on a tree, to add it to your trees!";
                                request('POST', '/protected/getPublicTreeData', treeToSearch, function() {
                                    if(this.readyState == 4 && this.status == 200) {
                              Severity: Minor
                              Found in new design/draft_offers_modal_design/user/src/search.js - About 1 hr to fix

                                Function switchSearch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function switchSearch(type){
                                  document.getElementById('advSearchDetails').innerHTML = "";
                                  if (type === "Skill") {
                                    document.getElementById('cardSearchBar').onkeyup = function(){
                                      if (Array.from(document.getElementById('skillSearchResult').options).find(obj => obj.value == document.getElementById('cardSearchBar').value) == undefined){
                                Severity: Minor
                                Found in new design/draft_offers_modal_design/user/src/search.js - About 1 hr to fix

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

                                          _finishInteractionProcess: function (event, func) {
                                              var queue = this._queue;
                                              var q = queue[0];
                                              var i = 0;
                                              for (; i < q.length; i++) {
                                  Severity: Minor
                                  Found in new design/draft_create_skill_modal_design/user/pixi/pixi-layers.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language