plainblack/Lacuna-Web-Client

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

Summary

Maintainability
F
4 mos
Test Coverage

File tradeMinistry.js has 2369 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

if (typeof YAHOO.lacuna.buildings.Trade == "undefined" || !YAHOO.lacuna.buildings.Trade) {
    
(function(){
Severity: Major
Found in app/js-yui/building/tradeMinistry.js - About 6 days to fix

    Function Trade has 128 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var Trade = function(result){
            Trade.superclass.constructor.call(this, result);
            
            this.transport = result.transport;
            this.service = Game.Services.Buildings.Trade;
    Severity: Major
    Found in app/js-yui/building/tradeMinistry.js - About 5 hrs to fix

      Function SupplyChainShipsPopulate has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              SupplyChainShipsPopulate : function() {
                  var ships = this.supply_chain_ships,
                      no_ships = Dom.get("supplyChainShipsNone"),
                      details = Dom.get("supplyChainShipsDetails"),
                      detailsParent = details.parentNode;
      Severity: Major
      Found in app/js-yui/building/tradeMinistry.js - About 3 hrs to fix

        Function Push has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                Push : function() {
                    var data = {
                            session_id: Game.GetSession(""),
                            building_id: this.building.id,
                            target_id: Lib.getSelectedOptionValue(Dom.get("tradePushColony")),
        Severity: Major
        Found in app/js-yui/building/tradeMinistry.js - About 3 hrs to fix

          Function AddTrade has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  AddTrade : function() {
                      var qVal = Dom.get("tradeAddAskingQuantity").value*1;
                      if(!Lang.isNumber(qVal) || qVal <= 0) {
                          Dom.get("tradeAddMessage").innerHTML = "Quantity of asking essentia must be a number and greater than 0";
                          return;
          Severity: Major
          Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

            Function SupplyChainList has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    SupplyChainList : function() {
                      var supply_chains = this.supply_chains;
                      
                      if ( supply_chains.length == 0 ) {
                        Dom.setStyle("supplyChainList", "display", "none");
            Severity: Major
            Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

              Function WasteChainShipsPopulate has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      WasteChainShipsPopulate : function() {
                          var ships = this.waste_chain_ships,
                              no_ships = Dom.get("wasteChainShipsNone"),
                              details = Dom.get("wasteChainShipsDetails");
                          
              Severity: Major
              Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

                Function PushAddShipSummary has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        PushAddShipSummary : function(e, matchedEl, container){
                            var quantity = matchedEl.previousSibling.value*1,
                                li = matchedEl.parentNode,
                                c = Dom.get("tradePushItems");
                            if(li && c) {
                Severity: Major
                Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

                  Function AvailablePopulate has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          AvailablePopulate : function() {
                              var details = Dom.get("tradeAvailableDetails");
                              
                              if(details) {
                                  var trades = this.availableTrades.trades,
                  Severity: Major
                  Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

                    Function AddShipSummary has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            AddShipSummary : function(e, matchedEl, container){
                                var quantity = matchedEl.previousSibling.value*1,
                                    li = matchedEl.parentNode,
                                    c = Dom.get("tradeAddItems");
                                if(li && c) {
                    Severity: Major
                    Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

                      Function AddPlanSummary has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              AddPlanSummary : function(e, matchedEl, container){
                                  var quantity = matchedEl.previousSibling.value*1,
                                      li = matchedEl.parentNode,
                                      c = Dom.get("tradeAddItems");
                                  if(li && c) {
                      Severity: Major
                      Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

                        Function PushAddPlanSummary has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                PushAddPlanSummary : function(e, matchedEl, container){
                                    var quantity = matchedEl.previousSibling.value*1,
                                        li = matchedEl.parentNode,
                                        c = Dom.get("tradePushItems");
                                    if(quantity && li && c) {
                        Severity: Major
                        Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

                          Function _getPushTab has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          _getPushTab : function() {
                          this.push = new YAHOO.widget.Tab({ label: "Push", content: [
                              '<div id="pHt"><div class="tradeStash yui-g">',
                              '    <div class="yui-u first">',
                              '        <legend>On Planet</legend>',
                          Severity: Minor
                          Found in app/js-yui/building/tradeMinistry.js - About 2 hrs to fix

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

                                    PushAddResource : function(e, matchedEl, container){
                                        var quantity = matchedEl.previousSibling.value*1,
                                            li = matchedEl.parentNode,
                                            c = Dom.get("tradePushItems");
                                        if(quantity && c) {
                            Severity: Minor
                            Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

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

                                      AddResource : function(e, matchedEl, container){
                                          var quantity = matchedEl.previousSibling.value*1,
                                              li = matchedEl.parentNode,
                                              c = Dom.get("tradeAddItems");
                                          if(quantity && c) {
                              Severity: Minor
                              Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                Function PushAddGlyphSummary has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        PushAddGlyphSummary : function(e, matchedEl, container){
                                            var quantity = matchedEl.previousSibling.value*1,
                                                li = matchedEl.parentNode,
                                                c = Dom.get("tradePushItems");
                                            if(li && c) {
                                Severity: Minor
                                Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                  Function AddGlyphSummary has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          AddGlyphSummary : function(e, matchedEl, container){
                                              var quantity = matchedEl.previousSibling.value*1,
                                                  li = matchedEl.parentNode,
                                                  c = Dom.get("tradeAddItems");
                                              if(li && c) {
                                  Severity: Minor
                                  Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                    Function MinePopulate has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            MinePopulate : function() {
                                                var details = Dom.get("tradeMineDetails");
                                                
                                                if(details) {
                                                    var trades = this.mineTrades.trades,
                                    Severity: Minor
                                    Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                      Function viewSupplyShips has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              viewSupplyShips : function(e) {
                                                  // we have 2 asynchronous functions below both wanting to hide
                                                  // the pulser - keep a count of requests so it only gets hidden
                                                  // once they've both completed
                                                  var request_count = 0;
                                      Severity: Minor
                                      Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

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

                                        _getSupplyChainTab : function() {
                                            var planets = Lib.planetarySort(Game.EmpireData.planets),
                                                current_planet = Game.GetCurrentPlanet(),
                                                target_options = "";
                                        
                                        
                                        Severity: Minor
                                        Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                          Function _getAddTradeTab has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                          _getAddTradeTab : function() {
                                                           this.add = new YAHOO.widget.Tab({ label: "Add Trade", content: [
                                                                   '<div id="aHt"><div class="tradeStash yui-g">',
                                                                   '    <div class="yui-u first">',
                                                                   '        <legend>On Planet</legend>',
                                          Severity: Minor
                                          Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                            Function resourceOptionsHTML has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                    resourceOptionsHTML : function(selected) {
                                                        var resource_options = "";
                                                
                                                        for(r in Lib.ResourceTypes) {
                                                            if(Lib.ResourceTypes.hasOwnProperty(r)) {
                                            Severity: Minor
                                            Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                              Function getPushShips has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                      getPushShips : function() {
                                                          var targetId = Lib.getSelectedOptionValue("tradePushColony");
                                                          if(targetId) {
                                                              require('js/actions/menu/loader').show();
                                                              this.service.get_trade_ships({
                                              Severity: Minor
                                              Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                Function populateAddResourceName has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                        populateAddResourceName : function() {
                                                            var elm = Dom.get("tradeAddResourceName"),
                                                                li = document.createElement("li"), nLi, x, r, name, resource;
                                                                
                                                            if(elm) {
                                                Severity: Minor
                                                Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                  Function populatePushResourceName has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                          populatePushResourceName : function() {
                                                              var elm = Dom.get("tradePushResourceName"),
                                                                  li = document.createElement("li"), nLi, x, r, name, resource;
                                                                  
                                                              if(elm) {
                                                  Severity: Minor
                                                  Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                    Function getAddShips has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                            getAddShips : function() {
                                                                require('js/actions/menu/loader').show();
                                                                
                                                                this.service.get_trade_ships({
                                                                    session_id: Game.GetSession(""),
                                                    Severity: Minor
                                                    Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                      Function addResourceOptions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                              addResourceOptions : function(selectElement, selected) {
                                                                  for(r in Lib.ResourceTypes) {
                                                                      if(Lib.ResourceTypes.hasOwnProperty(r)) {
                                                                          resource = Lib.ResourceTypes[r];
                                                                          if(Lang.isArray(resource)) {
                                                      Severity: Minor
                                                      Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                        Function getAvailableTrades has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                                getAvailableTrades : function(e) {
                                                                    if(e.newValue) {
                                                                        require('js/actions/menu/loader').show();
                                                                        var data = {session_id:Game.GetSession(),building_id:this.building.id,page_number:1},
                                                                            selVal = Lib.getSelectedOptionValue("tradeFilter");
                                                        Severity: Minor
                                                        Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                          Function success has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                              success : function(o){
                                                                                  this.rpcSuccess(o);
                                                                                  
                                                                                  for(var i=0; i<lis.length; i++) {
                                                                                      if(lis[i].Object) {
                                                          Severity: Minor
                                                          Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                            Function MineWithdraw has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                            Open

                                                                    MineWithdraw : function() {
                                                                        if(confirm(['Are you sure you want to withdraw the trade asking for ', this.Trade.ask, ' essentia and offering ', this.Trade.offer.join(', '),'?'].join(''))) {
                                                                            require('js/actions/menu/loader').show();
                                                                            this.Self.service.withdraw_from_market({
                                                                                session_id:Game.GetSession(""),
                                                            Severity: Minor
                                                            Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

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

                                                                              success : function(o){
                                                                                  this.rpcSuccess(o);
                                                                                  if(hasResources) {
                                                                                      this.getStoredResources(true);
                                                                                  }
                                                              Severity: Minor
                                                              Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                        if(obj.extra_build_level > 0) {
                                                                                            nLi.innerHTML = ['<span class="tradeResourceName">',obj.name,' ',obj.level,'+',obj.extra_build_level, ' (<label class="quantity">', obj.quantity, '</label>)</span> <input type="text" style="width:75px;" /><button type="button">+</button>'].join('');
                                                                                        }
                                                                                        else {
                                                                                            nLi.innerHTML = ['<span class="tradeResourceName">',obj.name,' ',obj.level, ' (<label class="quantity">', obj.quantity, '</label>)</span> <input type="text" style="width:75px;" /><button type="button">+</button>'].join('');
                                                                Severity: Major
                                                                Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                                          for(x=0; x < resource.length; x++) {
                                                                                              name = resource[x];
                                                                                              option = document.createElement("option");
                                                                                              option.setAttribute("value", name);
                                                                                              option.innerHTML = name.titleCaps();
                                                                  Severity: Major
                                                                  Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                        else if(resource) {
                                                                                            option = document.createElement("option");
                                                                                            option.setAttribute("value", r);
                                                                                            option.innerHTML = r.titleCaps();
                                                                                            
                                                                    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

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

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

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

                                                                            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 (obj.extra_build_level > 0) {
                                                                                                          nLi.innerHTML = ['<span class="tradeResourceName">',obj.name,' ',obj.level,'+',obj.extra_build_level, ' (<label class="quantity">', obj.quantity, '</label>)</span> <input type="text" style="width:75px;" /><button type="button">+</button>'].join('');
                                                                                                      }
                                                                                                      else {
                                                                                                          nLi.innerHTML = ['<span class="tradeResourceName">',obj.name,' ',obj.level,' (<label class="quantity">', obj.quantity, '</label>)</span> <input type="text" style="width:75px;" /><button type="button">+</button>'].join('');
                                                                              Severity: Major
                                                                              Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

                                                                                Avoid deeply nested control flow statements.
                                                                                Open

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

                                                                                  Avoid deeply nested control flow statements.
                                                                                  Open

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

                                                                                    Avoid deeply nested control flow statements.
                                                                                    Open

                                                                                                            for(x=0; x < resource.length; x++) {
                                                                                                                name = resource[x];
                                                                                                                resource_options += [
                                                                                                                    '<option value="', name, '"'
                                                                                                                ].join('');
                                                                                    Severity: Major
                                                                                    Found in app/js-yui/building/tradeMinistry.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(Dom.getStyle("tradePushPlanSummaryName", "display") == "none") {
                                                                                                                            Dom.setStyle("tradePushPlanSummaryName", "display", "block");
                                                                                                                            this.getPlanSummary();
                                                                                                                        }
                                                                                                                        else {
                                                                                        Severity: Major
                                                                                        Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

                                                                                          Avoid deeply nested control flow statements.
                                                                                          Open

                                                                                                                          if(Dom.getStyle("tradeAddPlanSummaryName", "display") == "none") {
                                                                                                                              Dom.setStyle("tradeAddPlanSummaryName", "display", "block");
                                                                                                                              this.getPlanSummary();
                                                                                                                          }
                                                                                                                          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

                                                                                                                              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(Dom.getStyle("tradePushPrisonerName", "display") == "none") {
                                                                                                                                    Dom.setStyle("tradePushPrisonerName", "display", "block");
                                                                                                                                    this.getPrisoners();
                                                                                                                                }
                                                                                                                                else {
                                                                                                Severity: Major
                                                                                                Found in app/js-yui/building/tradeMinistry.js - About 45 mins to fix

                                                                                                  Avoid deeply nested control flow statements.
                                                                                                  Open

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

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

                                                                                                                if(details) {
                                                                                                                    var ul = document.createElement("ul"),
                                                                                                                        li = document.createElement("li"),
                                                                                                                        availShips = [],
                                                                                                                        workingShips = [];
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 4 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2235..2306

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

                                                                                                    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(details) {
                                                                                                                    var ul = document.createElement("ul"),
                                                                                                                        li = document.createElement("li"),
                                                                                                                        availShips = [],
                                                                                                                        workingShips = [];
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 4 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2476..2547

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

                                                                                                    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

                                                                                                            PushAddPlanSummary : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradePushItems");
                                                                                                                if(quantity && li && c) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 4 days to fix
                                                                                                    app/js-yui/building/transporter.js on lines 1567..1622

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

                                                                                                    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

                                                                                                            PushAddShipSummary : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradePushItems");
                                                                                                                if(li && c) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 4 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1137..1192
                                                                                                    app/js-yui/building/transporter.js on lines 1623..1686

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

                                                                                                    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

                                                                                                            AddShipSummary : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradeAddItems");
                                                                                                                if(li && c) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 4 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1663..1726
                                                                                                    app/js-yui/building/transporter.js on lines 1623..1686

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

                                                                                                    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

                                                                                                            PushAddResource : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradePushItems");
                                                                                                                if(quantity && c) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 3 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 985..1035
                                                                                                    app/js-yui/building/transporter.js on lines 975..1025

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

                                                                                                    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

                                                                                                            AddResource : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradeAddItems");
                                                                                                                if(quantity && c) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 3 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1509..1559
                                                                                                    app/js-yui/building/transporter.js on lines 975..1025

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

                                                                                                    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

                                                                                                            MinePopulate : function() {
                                                                                                                var details = Dom.get("tradeMineDetails");
                                                                                                                
                                                                                                                if(details) {
                                                                                                                    var trades = this.mineTrades.trades,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 3 days to fix
                                                                                                    app/js-yui/building/mercenariesGuild.js on lines 322..380
                                                                                                    app/js-yui/building/transporter.js on lines 716..774

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

                                                                                                    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

                                                                                                            AddGlyphSummary : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradeAddItems");
                                                                                                                if(li && c) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 3 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1560..1605
                                                                                                    app/js-yui/building/transporter.js on lines 1026..1071

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

                                                                                                    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

                                                                                                            PushAddGlyphSummary : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradePushItems");
                                                                                                                if(li && c) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 3 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1036..1081
                                                                                                    app/js-yui/building/transporter.js on lines 1026..1071

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

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

                                                                                                            populateAddResourceName : function() {
                                                                                                                var elm = Dom.get("tradeAddResourceName"),
                                                                                                                    li = document.createElement("li"), nLi, x, r, name, resource;
                                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 2 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1327..1364
                                                                                                    app/js-yui/building/transporter.js on lines 831..868
                                                                                                    app/js-yui/building/transporter.js on lines 1325..1362

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

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

                                                                                                            populatePushResourceName : function() {
                                                                                                                var elm = Dom.get("tradePushResourceName"),
                                                                                                                    li = document.createElement("li"), nLi, x, r, name, resource;
                                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 2 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 808..845
                                                                                                    app/js-yui/building/transporter.js on lines 831..868
                                                                                                    app/js-yui/building/transporter.js on lines 1325..1362

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

                                                                                                    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.add.subscribe("activeChange", function(e) {
                                                                                                                        if(e.newValue) {
                                                                                                                            this.getAddShips();
                                                                                                                            
                                                                                                                            if(!this.tradeAddSubbed) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 2 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 43..98

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

                                                                                                    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.push.subscribe("activeChange", function(e) {
                                                                                                                        if(e.newValue) {
                                                                                                                            this.getPushShips();
                                                                                                                            
                                                                                                                            if(!this.tradePushSubbed) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 2 days to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 99..154

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

                                                                                                    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

                                                                                                            MineWithdraw : function() {
                                                                                                                if(confirm(['Are you sure you want to withdraw the trade asking for ', this.Trade.ask, ' essentia and offering ', this.Trade.offer.join(', '),'?'].join(''))) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    this.Self.service.withdraw_from_market({
                                                                                                                        session_id:Game.GetSession(""),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 2 days to fix
                                                                                                    app/js-yui/building/transporter.js on lines 798..828

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

                                                                                                    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

                                                                                                            AddPrisoner : function(e, matchedEl, container){
                                                                                                                var li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradeAddItems");
                                                                                                                if(li && c) {
                                                                                                                    var obj = li.Prisoner,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1727..1752

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

                                                                                                    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

                                                                                                            PushAddPrisoner : function(e, matchedEl, container){
                                                                                                                var li = matchedEl.parentNode,
                                                                                                                    c = Dom.get("tradePushItems");
                                                                                                                if(li && c) {
                                                                                                                    var obj = li.Prisoner,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1194..1219

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

                                                                                                    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

                                                                                                            PushRemove : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode.parentNode;
                                                                                                                if(quantity) {
                                                                                                                    var newTotal = li.Object.quantity - quantity,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1220..1245
                                                                                                    app/js-yui/building/transporter.js on lines 1221..1246

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

                                                                                                    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

                                                                                                            AddRemove : function(e, matchedEl, container){
                                                                                                                var quantity = matchedEl.previousSibling.value*1,
                                                                                                                    li = matchedEl.parentNode.parentNode;
                                                                                                                if(quantity) {
                                                                                                                    var newTotal = li.Object.quantity - quantity,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1753..1778
                                                                                                    app/js-yui/building/transporter.js on lines 1221..1246

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

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

                                                                                                            populateAddPlanSummaryName : function() {
                                                                                                                var elm = Dom.get("tradeAddPlanSummaryName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1388..1414
                                                                                                    app/js-yui/building/transporter.js on lines 891..917
                                                                                                    app/js-yui/building/transporter.js on lines 1386..1412

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

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

                                                                                                            populatePushPlanSummaryName : function() {
                                                                                                                var elm = Dom.get("tradePushPlanSummaryName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 868..894
                                                                                                    app/js-yui/building/transporter.js on lines 891..917
                                                                                                    app/js-yui/building/transporter.js on lines 1386..1412

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

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

                                                                                                            getAvailableTrades : function(e) {
                                                                                                                if(e.newValue) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    var data = {session_id:Game.GetSession(),building_id:this.building.id,page_number:1},
                                                                                                                        selVal = Lib.getSelectedOptionValue("tradeFilter");
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/transporter.js on lines 513..546

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

                                                                                                    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.add_to_market(data, {
                                                                                                                    success : function(o){
                                                                                                                        this.rpcSuccess(o);
                                                                                                                        if(hasResources) {
                                                                                                                            this.getStoredResources(true);
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/transporter.js on lines 1291..1321

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

                                                                                                    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

                                                                                                            getMyTrades : function(e) {
                                                                                                                if(e.newValue) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    this.service.view_my_market({session_id:Game.GetSession(),building_id:this.building.id,page_number:1}, {
                                                                                                                        success : function(o){
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/transporter.js on lines 687..715

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

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

                                                                                                            populateAddShipSummaryName : function() {
                                                                                                                var elm = Dom.get("tradeAddShipSummaryName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1415..1442
                                                                                                    app/js-yui/building/transporter.js on lines 918..947
                                                                                                    app/js-yui/building/transporter.js on lines 1413..1442

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

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

                                                                                                            populatePushShipSummaryName : function() {
                                                                                                                var elm = Dom.get("tradePushShipSummaryName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 895..921
                                                                                                    app/js-yui/building/transporter.js on lines 918..947
                                                                                                    app/js-yui/building/transporter.js on lines 1413..1442

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

                                                                                                    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

                                                                                                            WasteChainShipAdd : function() {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                
                                                                                                                this.Self.service.add_waste_ship_to_fleet({
                                                                                                                    session_id:Game.GetSession(),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2575..2600

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

                                                                                                    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

                                                                                                            WasteChainShipRemove : function() {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                
                                                                                                                this.Self.service.remove_waste_ship_from_fleet({
                                                                                                                    session_id:Game.GetSession(),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2549..2574

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

                                                                                                    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

                                                                                                            SupplyChainShipAdd : function() {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                
                                                                                                                this.Self.service.add_supply_ship_to_fleet({
                                                                                                                    session_id:Game.GetSession(),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2334..2359

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

                                                                                                    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

                                                                                                            SupplyChainShipRemove : function() {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                
                                                                                                                this.Self.service.remove_supply_ship_from_fleet({
                                                                                                                    session_id:Game.GetSession(),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2308..2333

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

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

                                                                                                            populateAddGlyphSummaryName : function() {
                                                                                                                var elm = Dom.get("tradeAddGlyphSummaryName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1365..1386
                                                                                                    app/js-yui/building/transporter.js on lines 869..890
                                                                                                    app/js-yui/building/transporter.js on lines 1363..1384

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

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

                                                                                                            populatePushGlyphSummaryName : function() {
                                                                                                                var elm = Dom.get("tradePushGlyphSummaryName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 846..867
                                                                                                    app/js-yui/building/transporter.js on lines 869..890
                                                                                                    app/js-yui/building/transporter.js on lines 1363..1384

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

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

                                                                                                            populatePushPrisonerName : function() {
                                                                                                                var elm = Dom.get("tradePushPrisonerName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 922..943
                                                                                                    app/js-yui/building/transporter.js on lines 948..969
                                                                                                    app/js-yui/building/transporter.js on lines 1443..1464

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

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

                                                                                                            populateAddPrisonerName : function() {
                                                                                                                var elm = Dom.get("tradeAddPrisonerName"),
                                                                                                                    li = document.createElement("li"), nLi;
                                                                                                                    
                                                                                                                if(elm) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1443..1464
                                                                                                    app/js-yui/building/transporter.js on lines 948..969
                                                                                                    app/js-yui/building/transporter.js on lines 1443..1464

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

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

                                                                                                            AvailableHandlePagination : function(newState) {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                var data = {session_id:Game.GetSession(),building_id:this.building.id,page_number:newState.page},
                                                                                                                    selVal = Lib.getSelectedOptionValue("tradeFilter");
                                                                                                                if(selVal) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 day to fix
                                                                                                    app/js-yui/building/transporter.js on lines 621..644

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

                                                                                                    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

                                                                                                            MineHandlePagination : function(newState) {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                this.service.view_my_market({
                                                                                                                    session_id:Game.GetSession(),
                                                                                                                    building_id:this.building.id,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 1 day to fix
                                                                                                    app/js-yui/building/mercenariesGuild.js on lines 381..403
                                                                                                    app/js-yui/building/transporter.js on lines 775..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 196.

                                                                                                    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.supply_chain_ships ) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    request_count++;
                                                                                                                    
                                                                                                                    this.service.get_supply_ships({session_id:Game.GetSession(),building_id:this.building.id}, {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 7 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2160..2181

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

                                                                                                    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.supply_chains ) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    request_count++;
                                                                                                                    
                                                                                                                    this.service.view_supply_chains({session_id:Game.GetSession(),building_id:this.building.id}, {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 7 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2183..2204

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

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

                                                                                                            AvailableReport : function() {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                this.Self.service.report_abuse({
                                                                                                                    session_id:Game.GetSession(""),
                                                                                                                    building_id:this.Self.building.id,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 7 hrs to fix
                                                                                                    app/js-yui/building/transporter.js on lines 662..680

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

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

                                                                                                            getGlyphSummary : function(force) {
                                                                                                                if(force || !this.glyph_summary) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    this.service.get_glyph_summary({
                                                                                                                            session_id: Game.GetSession(""),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 7 other locations - About 7 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 417..434
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 435..452
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 453..470
                                                                                                    app/js-yui/building/transporter.js on lines 423..440
                                                                                                    app/js-yui/building/transporter.js on lines 441..458
                                                                                                    app/js-yui/building/transporter.js on lines 459..476
                                                                                                    app/js-yui/building/transporter.js on lines 477..494

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

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

                                                                                                            getPrisoners : function(force) {
                                                                                                                if(force || !this.prisoners) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    this.service.get_prisoners({
                                                                                                                            session_id: Game.GetSession(""),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 7 other locations - About 7 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 398..415
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 417..434
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 453..470
                                                                                                    app/js-yui/building/transporter.js on lines 423..440
                                                                                                    app/js-yui/building/transporter.js on lines 441..458
                                                                                                    app/js-yui/building/transporter.js on lines 459..476
                                                                                                    app/js-yui/building/transporter.js on lines 477..494

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

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

                                                                                                            getPlanSummary : function(force) {
                                                                                                                if(force || !this.plan_summary) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    this.service.get_plan_summary({
                                                                                                                            session_id: Game.GetSession(""),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 7 other locations - About 7 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 398..415
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 435..452
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 453..470
                                                                                                    app/js-yui/building/transporter.js on lines 423..440
                                                                                                    app/js-yui/building/transporter.js on lines 441..458
                                                                                                    app/js-yui/building/transporter.js on lines 459..476
                                                                                                    app/js-yui/building/transporter.js on lines 477..494

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

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

                                                                                                            getShipSummary : function(force) {
                                                                                                                if(force || !this.ship_summary) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    this.service.get_ship_summary({
                                                                                                                            session_id: Game.GetSession(""),
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 7 other locations - About 7 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 398..415
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 417..434
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 435..452
                                                                                                    app/js-yui/building/transporter.js on lines 423..440
                                                                                                    app/js-yui/building/transporter.js on lines 441..458
                                                                                                    app/js-yui/building/transporter.js on lines 459..476
                                                                                                    app/js-yui/building/transporter.js on lines 477..494

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

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

                                                                                                    Event.onAvailable("tradePushColony", function(){
                                                                                                            var opt = document.createElement("option"),
                                                                                                                planets = This.transport.pushable;
                                                                                                    
                                                                                                            for(var p=0; p<planets.length; p++) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 7 hrs to fix
                                                                                                    app/js-yui/building/transporter.js on lines 251..262

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

                                                                                                    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

                                                                                                            AvailableAccept : function() {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                this.Self.service.accept_from_market({
                                                                                                                    session_id:Game.GetSession(""),
                                                                                                                    building_id:this.Self.building.id,
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 6 hrs to fix
                                                                                                    app/js-yui/building/transporter.js on lines 645..661

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

                                                                                                    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

                                                                                                            WasteChainShipsView : function() {
                                                                                                                require('js/actions/menu/loader').show();
                                                                                                                this.service.get_waste_ships({session_id:Game.GetSession(),building_id:this.building.id}, {
                                                                                                                    success : function(o){
                                                                                                                        YAHOO.log(o, "info", "Trade.WasteChainShipsView.success");
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 5 hrs to fix
                                                                                                    app/js-yui/building/miningMinistry.js on lines 261..274

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

                                                                                                    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

                                                                                                                for(n=0; n<lis.length; n++) {
                                                                                                                    obj = lis[n].Object;
                                                                                                                    if(obj) {
                                                                                                                        data.offer[data.offer.length] = obj;
                                                                                                                        switch(obj.type) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 5 hrs to fix
                                                                                                    app/js-yui/building/transporter.js on lines 1266..1288

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

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

                                                                                                                if(this.result.building.efficiency >= 100 && ( force || !this.resources) ) {
                                                                                                                    require('js/actions/menu/loader').show();
                                                                                                                    this.service.get_stored_resources({
                                                                                                                            session_id: Game.GetSession(""),
                                                                                                                            building_id: this.building.id
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 4 hrs to fix
                                                                                                    app/js-yui/building/transporter.js on lines 496..510

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

                                                                                                    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

                                                                                                                for(var n=0; n<lis.length; n++) {
                                                                                                                    if(lis[n].Object) {
                                                                                                                        items[n] = lis[n].Object;
                                                                                                                        switch(items[n].type) {
                                                                                                                            case "plan":
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 4 hrs to fix
                                                                                                    app/js-yui/building/transporter.js on lines 1749..1770

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

                                                                                                    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

                                                                                                    _getAvailableTradesTab : function() {
                                                                                                                       this.avail = new YAHOO.widget.Tab({ label: "Trades", content: [
                                                                                                                               '<div>',
                                                                                                                               '    <div style="border-bottom: 1px solid #52ACFF; padding-bottom: 5px; margin-bottom: 5px;"><label>Filter:</label><select id="tradeFilter"><option value="">All</option><option value="energy">Energy</option><option value="food">Food</option><option value="ore">Ore</option>',
                                                                                                                               '    <option value="water">Water</option><option value="waste">Waste</option><option value="glyph">Glyph</option><option value="prisoner">Prisoner</option>',
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 3 hrs to fix
                                                                                                    app/js-yui/building/transporter.js on lines 276..297

                                                                                                    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

                                                                                                    _getSupplyShipsTab : function() {
                                                                                                        this.supplyShipsTab = new YAHOO.widget.Tab({ label: "Supply Ships", content: [
                                                                                                            '<div id="supplyChainShipsInfo"></div><hr/>',
                                                                                                            '<div id="supplyChainShipsHeader">',
                                                                                                            '  <ul class="shipHeader shipInfo clearafter">',
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 2 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 377..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 94.

                                                                                                    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

                                                                                                    _getWasteChainTab : function() {
                                                                                                        this.wasteChainTab = new YAHOO.widget.Tab({ label: "Waste Chain", content: [
                                                                                                            '<div id="wasteChainDetails" style="margin-bottom: 2px"></div>',
                                                                                                            '<div id="wasteChainShips">',
                                                                                                            '    <ul class="shipHeader shipInfo clearafter">',
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 2 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 357..376

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

                                                                                                    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(percent_transferred == 0) {
                                                                                                                    output.push('You have no ships servicing your supply chains.');
                                                                                                                }
                                                                                                                else if(percent_transferred > 100) {
                                                                                                                    output.push('You have excess ships servicing your supply chains. You can increase your chain hourly rate, or you may be able to remove some ships to get closer to 100&#37;.');
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 2 hrs to fix
                                                                                                    app/js-yui/building/miningMinistry.js on lines 105..116

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

                                                                                                    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 5 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/tradeMinistry.js and 4 other locations - About 2 hrs to fix
                                                                                                    app/js-yui/building/blackHoleGenerator.js on lines 7..15
                                                                                                    app/js-yui/building/mercenariesGuild.js on lines 6..14
                                                                                                    app/js-yui/building/spacePort.js on lines 9..17
                                                                                                    app/js-yui/building/transporter.js on lines 6..14

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

                                                                                                    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

                                                                                                                }, {
                                                                                                                    success : function(o){
                                                                                                                        YAHOO.log(o, "info", "Trade.SupplyChainAddNew.success");
                                                                                                                        require('js/actions/menu/loader').hide();
                                                                                                                        this.Self.rpcSuccess(o);
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 2 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2119..2129
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2142..2152

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

                                                                                                    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

                                                                                                                }, {
                                                                                                                    success : function(o){
                                                                                                                        YAHOO.log(o, "info", "Trade.SupplyChainRemove.success");
                                                                                                                        require('js/actions/menu/loader').hide();
                                                                                                                        this.Self.rpcSuccess(o);
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 2 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2099..2109
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2119..2129

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

                                                                                                    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

                                                                                                                }, {
                                                                                                                    success : function(o){
                                                                                                                        YAHOO.log(o, "info", "Trade.SupplyChainUpdate.success");
                                                                                                                        require('js/actions/menu/loader').hide();
                                                                                                                        this.Self.rpcSuccess(o);
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 2 hrs to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2099..2109
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2142..2152

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

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

                                                                                                              setTimeout(function() {
                                                                                                                var Ht = Game.GetSize().h - 250;
                                                                                                                if(Ht > 250) { Ht = 250; }
                                                                                                                Dom.setStyle(detailsParent,"height",Ht + "px");
                                                                                                                Dom.setStyle(detailsParent,"overflow-y","auto");
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 2 hrs to fix
                                                                                                    app/js-yui/building.js on lines 438..443
                                                                                                    app/js-yui/building/blackHoleGenerator.js on lines 338..343
                                                                                                    app/js-yui/building/planetaryCommand.js on lines 382..387

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

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

                                                                                                            destroy : function() {
                                                                                                                if(this.availablePager) {
                                                                                                                    this.availablePager.destroy();
                                                                                                                }
                                                                                                                if(this.minePage) {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 2 hrs to fix
                                                                                                    app/js-yui/building/mercenariesGuild.js on lines 31..39
                                                                                                    app/js-yui/building/security.js on lines 25..33
                                                                                                    app/js-yui/building/transporter.js on lines 160..168

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

                                                                                                    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 (chain.stalled == 1) {
                                                                                                                    Dom.addClass(nUl, "supplyChainStalled");
                                                                                                                    nLi.innerHTML = chain.body.name + " (Stalled)";
                                                                                                                }
                                                                                                                else {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 hr to fix
                                                                                                    app/js-yui/building.js on lines 409..415

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

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

                                                                                                                if ( ships.length == 0 ) {
                                                                                                                    Dom.setStyle(details, "display", "none");
                                                                                                                    Dom.setStyle(no_ships, "display", "");
                                                                                                                    return;
                                                                                                                }
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 hr to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2466..2474

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

                                                                                                    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 ( supply_chains.length == 0 ) {
                                                                                                                Dom.setStyle("supplyChainList", "display", "none");
                                                                                                                Dom.setStyle("supplyChainListNone", "display", "");
                                                                                                                return;
                                                                                                              }
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 hr to fix
                                                                                                    app/js-yui/building.js on lines 377..385

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

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

                                                                                                                if ( ships.length == 0 ) {
                                                                                                                    Dom.setStyle(details, "display", "none");
                                                                                                                    Dom.setStyle(no_ships, "display", "");
                                                                                                                    return;
                                                                                                                }
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 hr to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 2218..2226

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

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

                                                                                                            updatePushCargo : function(byVal) {
                                                                                                                var c = Dom.get("tradePushCargo"),
                                                                                                                    cv = c.innerHTML.replace(/,/g, "")*1;
                                                                                                                c.innerHTML = Lib.formatNumber(cv + byVal);
                                                                                                            },
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 hr to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 980..984
                                                                                                    app/js-yui/building/transporter.js on lines 970..974
                                                                                                    app/js-yui/building/transporter.js on lines 1465..1469

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

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

                                                                                                            updateAddCargo : function(byVal) {
                                                                                                                var c = Dom.get("tradeAddCargo"),
                                                                                                                    cv = c.innerHTML.replace(/,/g,"")*1;
                                                                                                                c.innerHTML = Lib.formatNumber(cv + byVal);
                                                                                                            },
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 3 other locations - About 1 hr to fix
                                                                                                    app/js-yui/building/tradeMinistry.js on lines 1504..1508
                                                                                                    app/js-yui/building/transporter.js on lines 970..974
                                                                                                    app/js-yui/building/transporter.js on lines 1465..1469

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

                                                                                                    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

                                                                                                    _getMyTradesTab : function() {
                                                                                                                      this.mine = new YAHOO.widget.Tab({ label: "My Trades", content: ['<div class="myTrades">',
                                                                                                                              '    <ul class="tradeHeader tradeInfo clearafter">',
                                                                                                                              '        <li class="tradeOfferedDate">Offered Date</li>',
                                                                                                                              '        <li class="tradeAsking">Cost</li>',
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 1 hr to fix
                                                                                                    app/js-yui/building/mercenariesGuild.js on lines 70..83
                                                                                                    app/js-yui/building/transporter.js on lines 298..311

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

                                                                                                    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

                                                                                                                if(!Lang.isNumber(qVal) || qVal <= 0) {
                                                                                                                    Dom.get("tradeAddMessage").innerHTML = "Quantity of asking essentia must be a number and greater than 0";
                                                                                                                    return;
                                                                                                                }
                                                                                                                else {
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 2 other locations - About 1 hr to fix
                                                                                                    app/js-yui/building/mercenariesGuild.js on lines 502..508
                                                                                                    app/js-yui/building/transporter.js on lines 1249..1255

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

                                                                                                                return [this._getPushTab(), this._getAvailableTradesTab(), this._getMyTradesTab(), this._getAddTradeTab(), this._getSupplyChainTab(), this._getSupplyShipsTab(), this._getWasteChainTab()];
                                                                                                    Severity: Major
                                                                                                    Found in app/js-yui/building/tradeMinistry.js and 1 other location - About 1 hr to fix
                                                                                                    app/js-yui/building/spacePort.js on lines 42..42

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

                                                                                                    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