sicambria/skilltree

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

Summary

Maintainability
F
2 wks
Test Coverage

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

function getPublicSkillData(){
  var skillToSearch = {value: document.getElementById('cardSearchBar').value};
  document.getElementById("searchModalTitle").innerHTML = "Click on a skill, to view its details!";
  request('POST', '/protected/getPublicSkillData', skillToSearch, function() {
      if(this.readyState == 4 && this.status == 200) {
Severity: Major
Found in new design/draft_offers_modal_design/user/src/search.js - About 2 hrs to fix

    Function switchSearch has a Cognitive Complexity of 12 (exceeds 5 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

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

    function getPublicUserData(){
      var userToSearch = {value: document.getElementById('cardSearchBar').value};
      document.getElementById("searchModalTitle").innerHTML = "Click on a user, to view his/her main tree!";
      request('POST', '/protected/getPublicUserData', userToSearch, 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 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

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

          function getPublicUserData(){
            var userToSearch = {value: document.getElementById('cardSearchBar').value};
            document.getElementById("searchModalTitle").innerHTML = "Click on a user, to view his/her main tree!";
            request('POST', '/protected/getPublicUserData', userToSearch, function() {
                if(this.readyState == 4 && this.status == 200) {
          Severity: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 1 other location - About 2 days to fix
          public/user/src/search.js on lines 72..107

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

          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

          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: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 1 other location - About 2 days to fix
          public/user/src/search.js on lines 215..244

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

          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

          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: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 1 other location - About 2 days to fix
          public/user/src/search.js on lines 110..139

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

          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 () {
          Severity: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 5 other locations - About 1 day to fix
          new design/draft_create_skill_modal_design/user/src/search.js on lines 21..45
          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
          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 searchTreesByName (element, global) {
              var treeToSearch = {value: element.value};
              var TreeSearchResult = document.getElementById('TreeSearchResult');
              if (global) {
                  request('POST', '/protected/searchTreesByName', treeToSearch, function() {
          Severity: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 5 other locations - About 1 day to fix
          new design/draft_create_skill_modal_design/user/src/search.js on lines 21..45
          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 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 !== "") {
              request('POST', '/protected/searchUsersByName', userToSearch, function() {
          Severity: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 2 other locations - About 1 day to fix
          new design/draft_create_skill_modal_design/user/src/search.js on lines 2..18
          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];
          Severity: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 2 other locations - About 4 hrs to fix
          new design/draft_create_skill_modal_design/user/src/search.js on lines 204..208
          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,
          Severity: Major
          Found in new design/draft_offers_modal_design/user/src/search.js and 1 other location - About 3 hrs to fix
          new design/draft_create_skill_modal_design/user/src/search.js on lines 187..193

          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