plainblack/Lacuna-Web-Client

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

Summary

Maintainability
F
5 days
Test Coverage

File theDillonForge.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

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

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

            viewForgeMakePlan : function() {
                var make_plan = this.result.tasks.make_plan,
                    make_form = Dom.get("forgeMakePlanForm");
                
                if ( make_plan.length == 0 ) {
    Severity: Major
    Found in app/js-yui/building/theDillonForge.js - About 2 hrs to fix

      Function viewForgeSplitPlan has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              viewForgeSplitPlan : function() {
                  var split_plan = this.result.tasks.split_plan,
                      split_form = Dom.get("forgeSplitPlanForm");
                  
                  if ( split_plan.length == 0 ) {
      Severity: Major
      Found in app/js-yui/building/theDillonForge.js - About 2 hrs to fix

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

                SplitPlan : function() {
                    var selected = Lib.getSelectedOptionValue("forgeSplitPlanSelect"),
                        quantity = Dom.get("forgeSplitPlanQuantity").value;
                    
                    if ( selected == "" ) {
        Severity: Minor
        Found in app/js-yui/building/theDillonForge.js - About 1 hr to fix

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

                  MakePlan : function() {
                      var plan_class = Lib.getSelectedOptionValue("forgeMakePlanSelect"),
                          level = Dom.get("forgeMakePlanLevel").value;
                      
                      if ( plan_class == "" ) {
          Severity: Minor
          Found in app/js-yui/building/theDillonForge.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                if (a.extra_build_level > b.extra_build_level) {
                                  return 1;
                                }
                                else if (a.extra_build_level < b.extra_build_level) {
                                  return -1;
            Severity: Major
            Found in app/js-yui/building/theDillonForge.js - About 45 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return -1;
              Severity: Major
              Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return 0;
                Severity: Major
                Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                      return 1;
                  Severity: Major
                  Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return 1;
                    Severity: Major
                    Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                            return -1;
                      Severity: Major
                      Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                            return -1;
                        Severity: Major
                        Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                return 1;
                          Severity: Major
                          Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                  return 0;
                            Severity: Major
                            Found in app/js-yui/building/theDillonForge.js - About 30 mins to fix

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

                                          split_plan.sort(function(a,b) {
                                            if(a.name > b.name) {
                                              return 1;
                                            }
                                            else if(a.name < b.name) {
                              Severity: Major
                              Found in app/js-yui/building/theDillonForge.js and 1 other location - About 6 hrs to fix
                              app/js-yui/building/theDillonForge.js on lines 86..112

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

                              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

                                            else {
                                              if(a.name > b.name) {
                                                return 1;
                                              }
                                              else if(a.name < b.name) {
                              Severity: Major
                              Found in app/js-yui/building/theDillonForge.js and 1 other location - About 6 hrs to fix
                              app/js-yui/building/theDillonForge.js on lines 196..222

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

                              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

                                      _getForgeTab : function() {
                                          this.splitTab = new YAHOO.widget.Tab({ label: "Forge", content: [
                                              '<div id="forgeSplitPlan">',
                                              '  <div><b>Split a plan into glyphs.</b></div>',
                                              '  <div id="forgeSplitPlanForm"></div>',
                              Severity: Major
                              Found in app/js-yui/building/theDillonForge.js and 1 other location - About 3 hrs to fix
                              app/js-yui/building.js on lines 331..351

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

                              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

                                          this.Self.service.subsidize({session_id:Game.GetSession(),building_id:this.Self.building.id}, {
                                              success : function(o){
                                                  YAHOO.log(o, "info", "TheDillonForge.Subsidize.success");
                                                  require('js/actions/menu/loader').hide();
                                                  this.Self.rpcSuccess(o);
                              Severity: Major
                              Found in app/js-yui/building/theDillonForge.js and 2 other locations - About 2 hrs to fix
                              app/js-yui/building/theDillonForge.js on lines 165..174
                              app/js-yui/building/theDillonForge.js on lines 284..293

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

                              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", "TheDillonForge.MakePlan.success");
                                                      require('js/actions/menu/loader').hide();
                                                      this.Self.rpcSuccess(o);
                              Severity: Major
                              Found in app/js-yui/building/theDillonForge.js and 2 other locations - About 2 hrs to fix
                              app/js-yui/building/theDillonForge.js on lines 284..293
                              app/js-yui/building/theDillonForge.js on lines 312..321

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

                              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", "TheDillonForge.SplitPlan.success");
                                                          require('js/actions/menu/loader').hide();
                                                          this.Self.rpcSuccess(o);
                              Severity: Major
                              Found in app/js-yui/building/theDillonForge.js and 2 other locations - About 2 hrs to fix
                              app/js-yui/building/theDillonForge.js on lines 165..174
                              app/js-yui/building/theDillonForge.js on lines 312..321

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

                              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