plainblack/Lacuna-Web-Client

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

Summary

Maintainability
F
4 days
Test Coverage

File blackHoleGenerator.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

if (typeof YAHOO.lacuna.buildings.BlackHoleGenerator == "undefined" ||
           !YAHOO.lacuna.buildings.BlackHoleGenerator) {

Severity: Minor
Found in app/js-yui/building/blackHoleGenerator.js - About 5 hrs to fix

    Function PopulateBHGTab has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        PopulateBHGTab : function(target, actions) {
          var details = Dom.get("bhgActionsAvail"),
              detailsParent = details.parentNode,
              li = document.createElement("li");
    
    
    Severity: Major
    Found in app/js-yui/building/blackHoleGenerator.js - About 3 hrs to fix

      Function _getBHGTab has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _getBHGTab : function() {
            var zoneOptions = "";
            var zones = this.result.task_options.zones;
            for (var i=0; i<zones.length; i++) {
              zoneOptions += '<option value="' + zones[i] + '">' + zones[i] + '</option>';
      Severity: Major
      Found in app/js-yui/building/blackHoleGenerator.js - About 3 hrs to fix

        Function bhgParseResult has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            bhgParseResult : function(result, type) {
                var out = [ '<div class="yui-gd" style="margin-bottom:2px;">',
                  '  <div style="border:1px white solid;" class="yui-u" style="width:100%">',
                  '    <label style="font-weight:bold;">',type,'</label>',
                  '    <div>'
        Severity: Minor
        Found in app/js-yui/building/blackHoleGenerator.js - About 1 hr to fix

          Function PopulateBHGResult has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              PopulateBHGResult : function(target, effect) {
                var details = Dom.get("bhgResult"),
                  detailsParent = details.parentNode,
                  li = document.createElement("li");
          
          
          Severity: Minor
          Found in app/js-yui/building/blackHoleGenerator.js - About 1 hr to fix

            Function bhgGenerate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                bhgGenerate   : function(e) {
                  var oSelf = this.Self,
                    target = this.Target,
                    task = this.Task;
            
            
            Severity: Minor
            Found in app/js-yui/building/blackHoleGenerator.js - About 1 hr to fix

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

                  bhgGetActions : function() {
                    require('js/actions/menu/loader').show();
              
                    Dom.setStyle("bhgActions", "display", "none");
              
              
              Severity: Minor
              Found in app/js-yui/building/blackHoleGenerator.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                            for (var j=0; j<options.length; j++) {
                              typeSelector = typeSelector + [
                                '<option value="', options[j], '">', options[j], '</option>'
                              ].join('');
                            }
                Severity: Major
                Found in app/js-yui/building/blackHoleGenerator.js - About 45 mins to fix

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

                      cooldownQueue : function(remaining, el){
                        if(remaining <= 0) {
                          var span = Dom.get(el),
                            p = span.parentNode;
                          p.removeChild(span);
                  Severity: Major
                  Found in app/js-yui/building/blackHoleGenerator.js and 4 other locations - About 3 hrs to fix
                  app/js-yui/building/archaeology.js on lines 464..474
                  app/js-yui/building/distributionCenter.js on lines 300..310
                  app/js-yui/building/park.js on lines 93..103
                  app/js-yui/building/themePark.js on lines 86..96

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

                  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/blackHoleGenerator.js and 4 other locations - About 2 hrs to fix
                  app/js-yui/building/mercenariesGuild.js on lines 6..14
                  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 7 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/blackHoleGenerator.js and 6 other locations - About 2 hrs to fix
                  app/js-yui/building/spacePort.js on lines 1272..1277
                  app/js-yui/building/spacePort.js on lines 1411..1416
                  app/js-yui/mapStar.js on lines 805..810
                  app/js-yui/mapStar.js on lines 906..911
                  app/js-yui/mapStar.js on lines 1042..1047
                  app/js-yui/mapStar.js on lines 1095..1100

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

                  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/blackHoleGenerator.js and 3 other locations - About 2 hrs to fix
                  app/js-yui/building.js on lines 438..443
                  app/js-yui/building/planetaryCommand.js on lines 382..387
                  app/js-yui/building/tradeMinistry.js on lines 2064..2069

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

                          else if ( result.message === "Made Asteroid" ) {
                              var newtype = result['class'].replace( new RegExp(".*::", "g"), "" );
                              out = out + [
                                  result.name, ' is now a type ', newtype, ' asteroid of size ',
                                  result.size
                  Severity: Major
                  Found in app/js-yui/building/blackHoleGenerator.js and 1 other location - About 1 hr to fix
                  app/js-yui/building/blackHoleGenerator.js on lines 376..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 62.

                  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

                          else if ( result.message === "Made Planet" ) {
                              var newtype = result['class'].replace( new RegExp(".*::", "g"), "" );
                              out = out + [
                                  result.name, ' is now a type ', newtype, ' planet of size ',
                                  result.size
                  Severity: Major
                  Found in app/js-yui/building/blackHoleGenerator.js and 1 other location - About 1 hr to fix
                  app/js-yui/building/blackHoleGenerator.js on lines 369..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 62.

                  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

                          else if(selected == "zone") {
                            Dom.setStyle("bhgTargetSelectText", "display", "none");
                            Dom.setStyle("bhgTargetSelectXY", "display", "none");
                            Dom.setStyle("bhgTargetSelectZone", "display", "");
                            Dom.setStyle("bhgTargetSelectOrbit", "display", "none");
                  Severity: Major
                  Found in app/js-yui/building/blackHoleGenerator.js and 1 other location - About 1 hr to fix
                  app/js-yui/building/blackHoleGenerator.js on lines 88..110

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

                  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(selected == "xy") {
                            Dom.setStyle("bhgTargetSelectText", "display", "none");
                            Dom.setStyle("bhgTargetSelectXY", "display", "");
                            Dom.setStyle("bhgTargetSelectZone", "display", "none");
                            Dom.setStyle("bhgTargetSelectOrbit", "display", "none");
                  Severity: Major
                  Found in app/js-yui/building/blackHoleGenerator.js and 1 other location - About 1 hr to fix
                  app/js-yui/building/blackHoleGenerator.js on lines 94..110

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

                  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 (effect.target) {
                            var nLi = li.cloneNode(false);
                            nLi.innerHTML = this.bhgParseResult(effect.target, 'Success');
                            details.appendChild(nLi);
                          }
                  Severity: Minor
                  Found in app/js-yui/building/blackHoleGenerator.js and 1 other location - About 55 mins to fix
                  app/js-yui/building/blackHoleGenerator.js on lines 330..334

                  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

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

                          if (effect.side) {
                            var nLi = li.cloneNode(false);
                            nLi.innerHTML = this.bhgParseResult(effect.side, 'Side-Effect');
                            details.appendChild(nLi);
                          }
                  Severity: Minor
                  Found in app/js-yui/building/blackHoleGenerator.js and 1 other location - About 55 mins to fix
                  app/js-yui/building/blackHoleGenerator.js on lines 325..329

                  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