sicambria/skilltree

View on GitHub

Showing 537 of 537 total issues

Function insertSkill has a Cognitive Complexity of 30 (exceeds 5 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 4 hrs 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

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

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

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

            pdesc.innerHTML = "<b>Description by levels</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 public/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
new design/draft_offers_modal_design/user/src/search.js on lines 180..184

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

Function editMyTree has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function editMyTree () {
    hideAll();

    var treeName = document.getElementById("treeName");
    treeName.setAttribute('list', 'TreeSearchResult');
Severity: Major
Found in new design/draft_create_skill_modal_design/user/chartandtree.js - About 4 hrs to fix

    Function Group has 108 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var Group = (function (_super) {
            __extends(Group, _super);
            function Group(zIndex, sorting) {
                var _this = _super.call(this) || this;
                _this._activeLayer = null;
    Severity: Major
    Found in new design/draft_create_skill_modal_design/user/pixi/pixi-layers.js - About 4 hrs to fix

      Function Group has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var Group = (function (_super) {
              __extends(Group, _super);
              function Group(zIndex, sorting) {
                  var _this = _super.call(this) || this;
                  _this._activeLayer = null;
      Severity: Major
      Found in new design/draft_offers_modal_design/user/pixi/pixi-layers.js - About 4 hrs to fix

        Function createTree has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        function createTree () {
            hideAll();
        
            var treeName = document.getElementById("treeName");
            treeName.setAttribute('list', '');
        Severity: Minor
        Found in new design/draft_create_skill_modal_design/user/chartandtree.js - About 4 hrs 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

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

                for (var i = 0; i < this.skill.children.length; ++i) {
                    childNames += this.skill.children[i].name + ' (minimum point: ' + this.skill.children[i].minPoint;
                    if (!this.skill.children[i].recommended) childNames += ', required), ';
                    else childNames += '), ';
                }
        Severity: Major
        Found in public/user/classes/itemcontainer.js and 2 other locations - About 4 hrs to fix
        new design/draft_create_skill_modal_design/user/classes/itemcontainer.js on lines 682..686
        new design/draft_offers_modal_design/user/classes/itemcontainer.js on lines 698..702

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

        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

                for (var i = 0; i < this.skill.children.length; ++i) {
                    childNames += this.skill.children[i].name + ' (minimum point: ' + this.skill.children[i].minPoint;
                    if (!this.skill.children[i].recommended) childNames += ', required), ';
                    else childNames += '), ';
                }
        new design/draft_offers_modal_design/user/classes/itemcontainer.js on lines 698..702
        public/user/classes/itemcontainer.js on lines 722..726

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

        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

                for (var i = 0; i < this.skill.children.length; ++i) {
                    childNames += this.skill.children[i].name + ' (minimum point: ' + this.skill.children[i].minPoint;
                    if (!this.skill.children[i].recommended) childNames += ', required), ';
                    else childNames += '), ';
                }
        new design/draft_create_skill_modal_design/user/classes/itemcontainer.js on lines 682..686
        public/user/classes/itemcontainer.js on lines 722..726

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

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

        function saveEmail () {
            var email = document.getElementById("email");
        
            if (email.value != '') {
                request('POST', '/protected/newemail', {
        Severity: Major
        Found in public/user/chartandtree.js and 1 other location - About 4 hrs to fix
        public/user/chartandtree.js on lines 1179..1191

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

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

        function savePlace () {
            var place = document.getElementById("place");
        
            if (place.value != '') {
                request('POST', '/protected/newplace', {
        Severity: Major
        Found in public/user/chartandtree.js and 1 other location - About 4 hrs to fix
        public/user/chartandtree.js on lines 1193..1205

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

        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

        Function onreadystatechange has 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        offerHttpRequest.onreadystatechange = function() {
                            if(offerHttpRequest.readyState == 4 && offerHttpRequest.status == 200) {
                                if (offerHttpRequest.response !== undefined) {
                                    //Got the offer data, fill the offers table
        
        

          Function onreadystatechange has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                          offerHttpRequest.onreadystatechange = function() {
                              if(offerHttpRequest.readyState == 4 && offerHttpRequest.status == 200) {
                                  if (offerHttpRequest.response !== undefined) {
                                      //Got the offer data, fill the offers table
          
          
          Severity: Major
          Found in new design/draft_offers_modal_design/user/classes/itemcontainer.js - About 4 hrs to fix

            Function Stage has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var Stage = (function (_super) {
                    __extends(Stage, _super);
                    function Stage() {
                        var _this = _super.call(this) || this;
                        _this.isStage = true;
            Severity: Major
            Found in new design/draft_create_skill_modal_design/user/pixi/pixi-layers.js - About 3 hrs to fix

              Function onreadystatechange has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      offerHttpRequest.onreadystatechange = function() {
                        if(offerHttpRequest.readyState == 4 && offerHttpRequest.status == 200) {
                          if (offerHttpRequest.response !== undefined) {
                            //Got the offer data, fill the offers table
              
              
              Severity: Major
              Found in public/user/classes/itemcontainer.js - About 3 hrs to fix

                Function Stage has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var Stage = (function (_super) {
                        __extends(Stage, _super);
                        function Stage() {
                            var _this = _super.call(this) || this;
                            _this.isStage = true;
                Severity: Major
                Found in new design/draft_offers_modal_design/user/pixi/pixi-layers.js - About 3 hrs to fix

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

                                  if (this.parentObj.skill.achievedPoint < this.parentObj.skill.maxPoint) {
                                      change = true;
                                      document.getElementById('submitBtn').innerText = "Save";
                                      document.getElementById('submitBtn').href = "";
                                      this.parentObj.skill.achievedPoint++;
                  new design/draft_offers_modal_design/user/classes/itemcontainer.js on lines 303..310

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

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

                              if(this.parentObj.skill.achievedPoint > 0)
                              {
                                  change = true;
                                  document.getElementById('submitBtn').innerText = "Save";
                                  document.getElementById('submitBtn').href = "";
                  new design/draft_offers_modal_design/user/classes/itemcontainer.js on lines 284..290

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

                  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