AdrianArroyoCalle/gajse

View on GitHub

Showing 21 of 21 total issues

Function refresh has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    refresh: function(position,objects){
        /* objects should be scene.children */
        this.movements.RIGHT=true;
        this.movements.LEFT=true;
        this.movements.GO=true;
Severity: Minor
Found in lib/gajse-collision.js - About 3 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

Function startLoop has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    startLoop: function(rend, sc, cam, loadBox, data, inp){
        var THREE=require("three");
        var audio=require("./gajse-audio");
        var api=require("./gajse-api");
        var storage=require("./gajse-slim-storage");
Severity: Major
Found in lib/gajse-loop.js - About 2 hrs to fix

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

        tryToSay: function(){
            if(this.available && this.stack.length>0)
            {
                this.available=false;
                var current=this.stack.shift();
    Severity: Major
    Found in lib/gajse-msg.js - About 2 hrs to fix

      Function exports has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports=function(grunt){
          //browserify -r ./lib/gajse-api -r three > gajse.test.js
          grunt.initConfig({
              pkg: grunt.file.readJSON("package.json"),
              browserify: {
      Severity: Minor
      Found in Gruntfile.js - About 1 hr to fix

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

                if(this.input.getInput().KEY_W===true && collider.getMovements().GO===true)
                {
                    this.camera.position.z-=1.0*delta;
                }
        Severity: Major
        Found in lib/gajse-loop.js and 2 other locations - About 1 hr to fix
        lib/gajse-loop.js on lines 102..105
        lib/gajse-loop.js on lines 106..109

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

        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

                if(this.input.getInput().KEY_S===true && collider.getMovements().BACK===true)
                {
                    this.camera.position.z+=1.0*delta;
                }
        Severity: Major
        Found in lib/gajse-loop.js and 2 other locations - About 1 hr to fix
        lib/gajse-loop.js on lines 102..105
        lib/gajse-loop.js on lines 110..113

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

        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

                if(this.input.getInput().KEY_D===true && collider.getMovements().RIGHT===true)
                {
                    this.camera.position.x+=1.0*delta;
                }
        Severity: Major
        Found in lib/gajse-loop.js and 2 other locations - About 1 hr to fix
        lib/gajse-loop.js on lines 106..109
        lib/gajse-loop.js on lines 110..113

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

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

            enableAudio: function(){
                window.AudioContext = window.AudioContext || window.webkitAudioContext;
                this.audioContext=new AudioContext();
                document.addEventListener("GAJSE_SetBackgroundMusic",function(evt){
                    console.log("SET BACKGROUND MUSIC: "+evt.detail.resource);
        Severity: Minor
        Found in lib/gajse-audio.js - About 1 hr to fix

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

              refresh: function(position,objects){
                  /* objects should be scene.children */
                  this.movements.RIGHT=true;
                  this.movements.LEFT=true;
                  this.movements.GO=true;
          Severity: Minor
          Found in lib/gajse-collision.js - About 1 hr to fix

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

                loop: function(){
                    var THREE=require("three");
                    var collider=require("./gajse-collision");
                    var delta=this.clock.getDelta();
                    if(this.loadingBox!="")
            Severity: Minor
            Found in lib/gajse-loop.js - About 1 hr to fix

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

              exports.Item=function Item(nam,descriptio,im)
              {
                  var callbacks={
                      action: function(){},
                      thinking: function(){},
              Severity: Minor
              Found in lib/gajse-item.js - About 1 hr to fix

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

                    setHUD: function(resource){
                        var hud=storage.getURLResourceAs(resource,{type: "image/svg+xml"});
                        var xhr=new XMLHttpRequest();
                        xhr.open("GET",hud,true);
                        xhr.addEventListener("load",function(){
                Severity: Minor
                Found in lib/gajse-hud.js - About 1 hr to fix

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

                      playCutscene: function(resource,cback,subtitles){
                          this.callback=cback;
                          this.video=document.createElement("video");
                          this.article=document.getElementById("gajse");
                          this.article.style.position="relative";
                  Severity: Minor
                  Found in lib/gajse-cutscene.js - About 1 hr to fix

                    Function loop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        loop: function(){
                            var THREE=require("three");
                            var collider=require("./gajse-collision");
                            var delta=this.clock.getDelta();
                            if(this.loadingBox!="")
                    Severity: Minor
                    Found in lib/gajse-loop.js - About 55 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

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

                        startLoop: function(rend, sc, cam, loadBox, data, inp){
                    Severity: Minor
                    Found in lib/gajse-loop.js - About 45 mins to fix

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

                          tryToSay: function(){
                              if(this.available && this.stack.length>0)
                              {
                                  this.available=false;
                                  var current=this.stack.shift();
                      Severity: Minor
                      Found in lib/gajse-msg.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

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

                                          div[i].addEventListener("mouseout",function(evt){
                                              var myDiv=evt.target;
                                              myDiv.style.color="green";
                                          });
                      Severity: Minor
                      Found in lib/gajse-msg.js and 1 other location - About 40 mins to fix
                      lib/gajse-msg.js on lines 60..63

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

                      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

                                          div[i].addEventListener("mouseover",function(evt){
                                              var myDiv=evt.target;
                                              myDiv.style.color="yellow";
                                          });
                      Severity: Minor
                      Found in lib/gajse-msg.js and 1 other location - About 40 mins to fix
                      lib/gajse-msg.js on lines 64..67

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

                      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 say2 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          say2: function(text, skip, duration, position, color){
                      Severity: Minor
                      Found in lib/gajse-msg.js - About 35 mins to fix

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

                            setBackgroundMusic: function(resource){
                                var event=new CustomEvent("GAJSE_SetBackgroundMusic",{"detail" : {"resource" : resource}});
                                document.dispatchEvent(event);
                            },
                        Severity: Minor
                        Found in lib/gajse-api.js and 1 other location - About 35 mins to fix
                        lib/gajse-api.js on lines 56..59

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

                        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