plainblack/Lacuna-Web-Client

View on GitHub
app/js-yui/building/shipyard.js

Summary

Maintainability
F
3 days
Test Coverage

File shipyard.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

if (typeof YAHOO.lacuna.buildings.Shipyard == "undefined" || !YAHOO.lacuna.buildings.Shipyard) {
    
(function(){
Severity: Minor
Found in app/js-yui/building/shipyard.js - About 3 hrs to fix

    Function ShipPopulate has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            ShipPopulate : function() {
                var details = Dom.get("shipDetails");
                
                if(details) {
                    var ships = this.ships.buildable,
    Severity: Major
    Found in app/js-yui/building/shipyard.js - About 2 hrs to fix

      Function ShipyardDisplay has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              ShipyardDisplay : function() {
                  var bq = this.ship_build_queue,
                      div = Dom.get("shipsBuilding");
      
                  if(div) {
      Severity: Minor
      Found in app/js-yui/building/shipyard.js - About 1 hr to fix

        Function ShipBuild has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                ShipBuild : function(e) {
                    var btn = Event.getTarget(e);
                    btn.disabled = true;
                    require('js/actions/menu/loader').show();
                    var qty = Dom.get("ship_"+this.Type);
        Severity: Minor
        Found in app/js-yui/building/shipyard.js - About 1 hr to fix

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

                  _getBuildTab : function() {
                      var buildTab = new YAHOO.widget.Tab({ label: "Build Ships", content: [
                          '<div>',
                          '    <div class="clearafter" style="font-weight:bold;">',
                          '        <span id="shipDocksAvailable" style="float:left;"></span>',
          Severity: Minor
          Found in app/js-yui/building/shipyard.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                    if(filter == "All") {
                                        shipNames.push(shipType);
                                    }
                                    else if(filter == "Now" && ships[shipType].can) {
                                        shipNames.push(shipType);
            Severity: Major
            Found in app/js-yui/building/shipyard.js - About 45 mins to fix

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

                          buildTab.subscribe("activeChange", function(e) {
                              if(e.newValue) {
                                  this.getBuild();
                                  var Ht = Game.GetSize().h - 190;
                                  if(Ht > 300) { Ht = 300; }
              Severity: Major
              Found in app/js-yui/building/shipyard.js and 1 other location - About 3 hrs to fix
              app/js-yui/building/shipyard.js on lines 33..40

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

              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

                          queueTab.subscribe("activeChange", function(e) {
                              if(e.newValue) {
                                  this.getQueue();
                                  var Ht = Game.GetSize().h - 210;
                                  if(Ht > 300) { Ht = 300; }
              Severity: Major
              Found in app/js-yui/building/shipyard.js and 1 other location - About 3 hrs to fix
              app/js-yui/building/shipyard.js on lines 64..71

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

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

                      ShipyardQueue : function(remaining, elLine){
                          var compTime;
                          if(remaining <= 0) {
                              compTime = 'Overdue ' + Lib.formatTime(Math.round(-remaining));
                          }
              Severity: Major
              Found in app/js-yui/building/shipyard.js and 4 other locations - About 3 hrs to fix
              app/js-yui/building/spacePort.js on lines 494..503
              app/js-yui/building/spacePort.js on lines 967..976
              app/js-yui/mapStar.js on lines 743..752
              app/js-yui/module/policeStation.js on lines 187..196

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

              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

                              this.service.view_build_queue({session_id:Game.GetSession(),building_id:this.building.id,page_number:1}, {
                                  success : function(o){
                                      YAHOO.log(o, "info", "Shipyard.getQueue.view_build_queue.success");
                                      require('js/actions/menu/loader').hide();
                                      this.rpcSuccess(o);
              Severity: Major
              Found in app/js-yui/building/shipyard.js and 1 other location - About 2 hrs to fix
              app/js-yui/building/intelligence.js on lines 387..396

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

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

                  var Lang = YAHOO.lang,
                      Util = YAHOO.util,
                      Dom = Util.Dom,
                      Event = Util.Event,
                      Sel = Util.Selector,
              Severity: Major
              Found in app/js-yui/building/shipyard.js and 16 other locations - About 1 hr to fix
              app/js-yui/building.js on lines 8..15
              app/js-yui/building/development.js on lines 6..13
              app/js-yui/building/distributionCenter.js on lines 6..13
              app/js-yui/building/geneticsLab.js on lines 6..13
              app/js-yui/building/missionCommand.js on lines 6..13
              app/js-yui/building/network19.js on lines 6..13
              app/js-yui/building/park.js on lines 6..13
              app/js-yui/building/planetaryCommand.js on lines 13..20
              app/js-yui/building/spaceStationLab.js on lines 6..13
              app/js-yui/login.js on lines 13..20
              app/js-yui/mapPlanet.js on lines 12..19
              app/js-yui/mapStar.js on lines 8..15
              app/js-yui/module/parliament.js on lines 6..13
              app/js-yui/module/stationCommand.js on lines 6..13
              app/js-yui/profile.js on lines 13..20
              app/js-yui/stats.js on lines 12..19

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

              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(ship.can) {
                                      Event.on(Sel.query("button", nLi, true), "click", this.ShipBuild, {Self:this,Type:shipName,Ship:ship}, true);
                                  }
              Severity: Minor
              Found in app/js-yui/building/shipyard.js and 1 other location - About 40 mins to fix
              app/js-yui/mapStar.js on lines 795..797

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

              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