plainblack/Lacuna-Web-Client

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

Summary

Maintainability
F
1 wk
Test Coverage

File mercenariesGuild.js has 464 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

if (typeof YAHOO.lacuna.buildings.MercenariesGuild == "undefined" || !YAHOO.lacuna.buildings.MercenariesGuild) {
    
(function(){
Severity: Minor
Found in app/js-yui/building/mercenariesGuild.js - About 7 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.availableMercs.trades,
    Severity: Major
    Found in app/js-yui/building/mercenariesGuild.js - About 2 hrs 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.mineMercs.trades,
      Severity: Minor
      Found in app/js-yui/building/mercenariesGuild.js - About 1 hr to fix

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

                AddMerc : function(e) {
                    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: Minor
        Found in app/js-yui/building/mercenariesGuild.js - About 1 hr to fix

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

                  MineWithdraw : function(e) {
                      var btn = Event.getTarget(e);
                      btn.disabled = true;
                      if(confirm(['Are you sure you want to withdraw the trade asking for ', this.Trade.ask, ' essentia and offering ', this.Trade.offer,'?'].join(''))) {
                          require('js/actions/menu/loader').show();
          Severity: Minor
          Found in app/js-yui/building/mercenariesGuild.js - About 1 hr to fix

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

                    getAddShips : function(e) {
                        if(e.newValue && !this.tradeShips) {
                            require('js/actions/menu/loader').show();
                            
                            this.service.get_trade_ships({
            Severity: Minor
            Found in app/js-yui/building/mercenariesGuild.js - About 1 hr to fix

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

                      MinePopulate : function() {
                          var details = Dom.get("tradeMineDetails");
                          
                          if(details) {
                              var trades = this.mineMercs.trades,
              Severity: Major
              Found in app/js-yui/building/mercenariesGuild.js and 2 other locations - About 3 days to fix
              app/js-yui/building/tradeMinistry.js on lines 693..751
              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

                      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/mercenariesGuild.js and 2 other locations - About 1 day to fix
              app/js-yui/building/tradeMinistry.js on lines 752..774
              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

                              this.service.view_my_market({session_id:Game.GetSession(),building_id:this.building.id,page_number:1}, {
                                  success : function(o){
                                      require('js/actions/menu/loader').hide();
                                      this.rpcSuccess(o);
                                      
              Severity: Major
              Found in app/js-yui/building/mercenariesGuild.js and 1 other location - About 6 hrs to fix
              app/js-yui/building/mercenariesGuild.js on lines 125..147

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

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                              this.service.view_market(data, {
                                  success : function(o){
                                      require('js/actions/menu/loader').hide();
                                      this.rpcSuccess(o);
                                      
              Severity: Major
              Found in app/js-yui/building/mercenariesGuild.js and 1 other location - About 6 hrs to fix
              app/js-yui/building/mercenariesGuild.js on lines 297..319

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

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

                      destroy : function() {
                          if(this.availablePager) {
                              this.availablePager.destroy();
                          }
                          if(this.minePage) {
              Severity: Major
              Found in app/js-yui/building/mercenariesGuild.js and 3 other locations - About 2 hrs to fix
              app/js-yui/building/security.js on lines 25..33
              app/js-yui/building/tradeMinistry.js on lines 160..168
              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 3 locations. Consider refactoring.
              Open

                      _getMineTab : function() {
                          this.mine = new YAHOO.widget.Tab({ label: "My Mercs", content: ['<div class="myMercenariesGuilds">',
                              '    <ul class="tradeHeader tradeInfo clearafter">',
                              '        <li class="tradeOfferedDate">Offered Date</li>',
                              '        <li class="tradeAsking">Cost</li>',
              Severity: Major
              Found in app/js-yui/building/mercenariesGuild.js and 2 other locations - About 1 hr to fix
              app/js-yui/building/tradeMinistry.js on lines 254..267
              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/mercenariesGuild.js and 2 other locations - About 1 hr to fix
              app/js-yui/building/tradeMinistry.js on lines 1248..1254
              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 4 locations. Consider refactoring.
              Open

                      updateAddCargo : function(byVal) {
                          var c = Dom.get("tradeAddCargo"),
                              cv = c.innerHTML*1;
                          c.innerHTML = cv + byVal;
                      },
              Severity: Major
              Found in app/js-yui/building/mercenariesGuild.js and 3 other locations - About 55 mins to fix
              app/js-yui/building/distributionCenter.js on lines 225..229
              app/js-yui/building/embassy.js on lines 492..496
              app/js-yui/building/embassy.js on lines 497..501

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

              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