plainblack/Lacuna-Web-Client

View on GitHub

Showing 509 of 1,320 total issues

Avoid deeply nested control flow statements.
Open

                                if(Dom.getStyle("tradeAddGlyphSummaryName", "display") == "none") {
                                    Dom.setStyle("tradeAddGlyphSummaryName", "display", "block");
                                    this.getGlyphSummary();
                                }
                                else {
Severity: Major
Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    if(rf <= 0) {
                                        elm.innerHTML = "";
                                        YAHOO.log("Complete","info","buildingDetails.showEvent.BuildTimeRemaining");
                                        this.DetailsView({data:{id:building.id,url:building.url},x:building.x,y:building.y});
                                    }
    Severity: Major
    Found in app/js-yui/mapPlanet.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if(this.resultTypeList) {
                                  // Results need to be converted back to an array
                                  var aResult = [];
                                  // Match key is first
                                  aResult[0] = (YAHOO.lang.isString(oResult)) ? oResult : oResult[sMatchKey] || oResult[this.key];
      Severity: Major
      Found in app/js-yui/textboxList.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if(curNum != orig.length) {
                                    isDirty = true;
                                }
        Severity: Major
        Found in app/js-yui/textboxList.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if(Dom.getStyle("tradePushGlyphSummaryName", "display") == "none") {
                                              Dom.setStyle("tradePushGlyphSummaryName", "display", "block");
                                              this.getGlyphSummary();
                                          }
                                          else {
          Severity: Major
          Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if(Lang.isArray(resource)) {
                                        for(x=0; x < resource.length; x++) {
                                            name = resource[x];
                                            if(this.resources[name]) {
                                                nLi = li.cloneNode(false);
            Severity: Major
            Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for(var i=1; i<tbl.length; i++) {
                                          var row = tbl[i];
                                          tblOut.push("<tr>");
                                          for(var d=0; d<row.length; d++) {
                                              tblOut.push("<td>");
              Severity: Major
              Found in app/js-yui/messaging.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    else if(resource) {
                                        resource_options += [
                                            '<option value="', r, '"'
                                        ].join('');
                                        
                Severity: Major
                Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if(reason[2]) {
                                                  output = [reason[1], ' Requires higher production of ', (Lang.isArray(reason[2]) ? reason[2].join(', ') : reason[2])].join('');
                                              }
                                              else {
                                                  output = reason[1];
                  Severity: Major
                  Found in app/js-yui/library.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (planet.water_stored > planet.water_capacity) {
                                                    planet.water_stored = planet.water_capacity;
                                                } else if (planet.water_stored < 0) {
                                                    if (isNotStation) {
                                                        planet.happiness += planet.water_stored;
                    Severity: Major
                    Found in app/js/game.jsx - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  for (var id in qt) {
                                                      if (qt.hasOwnProperty(id)) {
                                                          var ms = qt[id] - tickMS;
                                                          if (ms <= 0) {
                                                              toFire[id] = type;
                      Severity: Major
                      Found in app/js/game.jsx - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (planet.energy_stored > planet.energy_capacity) {
                                                        planet.energy_stored = planet.energy_capacity;
                                                    } else if (planet.energy_stored < 0) {
                                                        if (isNotStation) {
                                                            planet.happiness += planet.energy_stored;
                        Severity: Major
                        Found in app/js/game.jsx - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (planet.food_stored > planet.food_capacity) {
                                                          planet.food_stored = planet.food_capacity;
                                                      } else if (planet.food_stored < 0) {
                                                          if (isNotStation) {
                                                              planet.happiness += planet.food_stored;
                          Severity: Major
                          Found in app/js/game.jsx - About 45 mins to fix

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

                                renderChat : function() {
                            
                                    // Only do this process once.
                                    // NOTE: it's checked before but we're just making sure. (nice rhyming)
                                    if (this.hasRenderedChat === true) {
                            Severity: Minor
                            Found in app/js/components/menu/chat.jsx - 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

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (planet.ore_stored > planet.ore_capacity) {
                                                            planet.ore_stored = planet.ore_capacity;
                                                        } else if (planet.ore_stored < 0) {
                                                            if (isNotStation) {
                                                                planet.happiness += planet.ore_stored;
                            Severity: Major
                            Found in app/js/game.jsx - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if (planet.waste_stored > planet.waste_capacity) {
                                                              wasteOverage = planet.waste_stored - planet.waste_capacity;
                                                              planet.waste_stored = planet.waste_capacity;
                                                          } else if (planet.waste_stored < 0) {
                                                              if (isNotStation) {
                              Severity: Major
                              Found in app/js/game.jsx - About 45 mins to fix

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

                                    getResourceStatus : function(hour, stored, capicity, hasCapicity) {
                                        // Different players have differnet strategies regarding waste. Some would consider full
                                        // waste good. Some would consider empty waste good. Therefore, we shouldn't comment
                                        // on what a player does or does not do with their waste.
                                        if (this.props.type === 'waste') {
                                Severity: Minor
                                Found in app/js/components/menu/bottomBar/resourceToolTip.jsx - 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

                                Avoid deeply nested control flow statements.
                                Open

                                                            if (status.empire.planets.hasOwnProperty(pKey)) {
                                                                var ePlanet = Lacuna.Game.EmpireData.planets[pKey];
                                                                if (!ePlanet) {
                                                                    Lacuna.Game.EmpireData.planets[pKey] = {
                                                                        id              : pKey,
                                Severity: Major
                                Found in app/js/game.jsx - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if (planet.happiness < 0 && ED.is_isolationist === '1') {
                                                                  planet.happiness = 0;
                                                              }
                                  Severity: Major
                                  Found in app/js/game.jsx - About 45 mins to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                    if (typeof YAHOO.lacuna.Mapper == "undefined" || !YAHOO.lacuna.Mapper) {
                                    
                                    (function(){
                                        var Lang = YAHOO.lang,
                                            Util = YAHOO.util,
                                    Severity: Major
                                    Found in app/js-yui/mapper.js - About 40 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language