sicambria/skilltree

View on GitHub
new design/draft_create_skill_modal_design/user/src/search.js

Summary

Maintainability
F
6 days
Test Coverage

Function getPublicUserData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getPublicUserData(){
  var userToSearch = {value: document.getElementById('cardSearchBar').value};
  request('POST', '/protected/getPublicUserData', userToSearch, function() {
      if(this.readyState == 4 && this.status == 200) {
        var modal = document.getElementById('searchModal');
Severity: Major
Found in new design/draft_create_skill_modal_design/user/src/search.js - About 2 hrs to fix

    Function getPublicSkillData has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getPublicSkillData(){
      var skillToSearch = {value: document.getElementById('cardSearchBar').value};
      request('POST', '/protected/getPublicSkillData', skillToSearch, function() {
          if(this.readyState == 4 && this.status == 200) {
            var modal = document.getElementById('searchModal');
    Severity: Major
    Found in new design/draft_create_skill_modal_design/user/src/search.js - About 2 hrs to fix

      Function onclick has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                row.onclick = function(){
                  var searchedUserModal = document.getElementById('searchedUserModal');
                  var closeSearchedUserModal = document.getElementById('closeSearchedUserModal');
                  var searchedUserModalHeader = document.getElementById('searchedUserModalHeader');
                  var searchedUserlModalInfo = document.getElementById('searchedUserlModalInfo');
      Severity: Minor
      Found in new design/draft_create_skill_modal_design/user/src/search.js - About 1 hr to fix

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

        function getPublicTreeData(){
          var treeToSearch = {value: document.getElementById('cardSearchBar').value};
          request('POST', '/protected/getPublicTreeData', treeToSearch, function() {
              if(this.readyState == 4 && this.status == 200) {
                var modal = document.getElementById('searchModal');
        Severity: Minor
        Found in new design/draft_create_skill_modal_design/user/src/search.js - About 1 hr to fix

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

          function searchTreesByName (element, global) {
              var treeToSearch = {value: element.value};
              var TreeSearchResult = document.getElementById('TreeSearchResult');
          
              if (global) {
          new design/draft_create_skill_modal_design/user/src/search.js on lines 48..71
          new design/draft_offers_modal_design/user/src/search.js on lines 20..43
          new design/draft_offers_modal_design/user/src/search.js on lines 46..69
          public/user/src/search.js on lines 20..43
          public/user/src/search.js on lines 46..69

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

          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

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

          function searchSkillsByName(element, global){
              var skillToSearch = {value: element.value};
              var skillSearchResult = document.getElementById('skillSearchResult');
              if (global) {
                  request('POST', '/protected/searchSkillsByName', skillToSearch, function () {
          new design/draft_create_skill_modal_design/user/src/search.js on lines 21..45
          new design/draft_offers_modal_design/user/src/search.js on lines 20..43
          new design/draft_offers_modal_design/user/src/search.js on lines 46..69
          public/user/src/search.js on lines 20..43
          public/user/src/search.js on lines 46..69

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

          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 3 locations. Consider refactoring.
          Open

          function searchUsersByName(){
            var userToSearch = {value: document.getElementById('cardSearchBar').value};
            var UserSearchResult = document.getElementById('UserSearchResult');
          
            if (userToSearch !== "") {
          new design/draft_offers_modal_design/user/src/search.js on lines 2..17
          public/user/src/search.js on lines 2..17

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

          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

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

                      pdesc.innerHTML = "<b>Description by points</b>: <br> 1: " + this.data.pointDescription[0] + "<br>" +
                                                                    "2: " + this.data.pointDescription[1] + "<br>" +
                                                                    "3: " + this.data.pointDescription[2] + "<br>" +
                                                                    "4: " + this.data.pointDescription[3] + "<br>" +
                                                                    "5: " + this.data.pointDescription[4];
          new design/draft_offers_modal_design/user/src/search.js on lines 180..184
          public/user/src/search.js on lines 184..188

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

          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

                    row.data = {
                      name: this.response[i].name,
                      categoryName: this.response[i].categoryName,
                      description: this.response[i].description,
                      pointDescription: this.response[i].pointDescription,
          new design/draft_offers_modal_design/user/src/search.js on lines 163..169

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

          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

          There are no issues that match your filters.

          Category
          Status