AdrianArroyoCalle/gajse

View on GitHub

Showing 14 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

        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

                      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
                        Severity
                        Category
                        Status
                        Source
                        Language