plainblack/Lacuna-Web-Client

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

Summary

Maintainability
F
1 wk
Test Coverage

File archaeology.js has 586 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

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

(function(){
Severity: Major
Found in app/js-yui/building/archaeology.js - About 1 day to fix

    Function ArchaeologyExcavators has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ArchaeologyExcavators : function() {
          var excavators = this.excavators.excavators,
                           details = Dom.get("excavatorDetails");
            
          if(details) {
    Severity: Major
    Found in app/js-yui/building/archaeology.js - About 2 hrs to fix

      Function populateView has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          populateView : function() {
            var glyphs = this.glyphs,
              details = Dom.get("archaeologyGlyphDetails");
              
            if(details) {
      Severity: Major
      Found in app/js-yui/building/archaeology.js - About 2 hrs to fix

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

            onDragDrop: function(e, id) {
              if (id == "archaeologyGlyphDetails") {
        
                // The position of the cursor at the time of the drop (YAHOO.util.Point)
                var pt = DDM.interactionInfo.point; 
        Severity: Minor
        Found in app/js-yui/building/archaeology.js - About 1 hr to fix

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

              _getViewTab : function() {
                var tab = new YAHOO.widget.Tab({ label: "View Glyphs", content: [
                  '<div class="clearafter">',
                  '  <div class="archaeologySlots">',
                  '    <label>Available Glyphs</label>',
          Severity: Minor
          Found in app/js-yui/building/archaeology.js - About 1 hr to fix

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

                _getSearchTab : function() {
                  var tab = new YAHOO.widget.Tab({ label: "Search", content: [
                    '<div id="archaeologySearchContainer">',
                    '  <ul id="archaeologySearchForm">',
                    '    <li>Search Ore:<select id="archaeologyOre"></select></li>',
            Severity: Minor
            Found in app/js-yui/building/archaeology.js - About 1 hr to fix

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

                  populateSearch : function() {
                    var sel = Dom.get("archaeologyOre");
                    if(sel && this.ore){
                      sel.options.length = 0;
                      var opt = document.createElement("option"),
              Severity: Minor
              Found in app/js-yui/building/archaeology.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                          if (fromAvailableList) {
                            // moving from 'details' list to 'combine' list
                            // clone it - don't just move it
                            var clone = El.cloneNode(true);
                            this._removeGlyphCount(clone);
                Severity: Major
                Found in app/js-yui/building/archaeology.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if(total > 0) {
                                outChance.splice(5, 0, '<li><label>Total:</label> ');
                                outChance.splice(6, 0, parseInt(total));
                                outChance.splice(7, 0, '</li>');
                              }
                  Severity: Major
                  Found in app/js-yui/building/archaeology.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                if (obj.id > 0) {
                                  nLi = li.cloneNode(false);
                                  Dom.addClass(nLi,"excavatorAbandon");
                                  var bbtn = document.createElement("button");
                                  bbtn.setAttribute("type", "button");
                    Severity: Major
                    Found in app/js-yui/building/archaeology.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  for (var chance_i in ctypes) {
                                    var chance = ctypes[chance_i];
                                    if(obj[chance] > 0) {
                                      outChance.push('<li><label>' + chance.replace(/^\w/,
                                                     function(c){ return c.toUpperCase() }) +
                      Severity: Major
                      Found in app/js-yui/building/archaeology.js - About 45 mins to fix

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

                              if(confirm(["Are you sure you want to Abandon the excavator ",this.Excavator.id," at  ",this.Excavator.body.name,"?"].join(''))) {
                                require('js/actions/menu/loader').show();
                                
                                this.Self.service.abandon_excavator({
                                  session_id:Game.GetSession(),
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 1 day to fix
                        app/js-yui/building/miningMinistry.js on lines 236..259

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

                        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

                            getGlyphs : function() {
                              if(!this.glyphs) {
                                require('js/actions/menu/loader').show();
                                this.service.get_glyphs({session_id:Game.GetSession(),building_id:this.building.id}, {
                                  success : function(o){
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 6 hrs to fix
                        app/js-yui/building/archaeology.js on lines 565..580

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

                        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

                            getOres : function() {
                              if(!this.ore) {
                                require('js/actions/menu/loader').show();
                                this.service.get_ores_available_for_processing({session_id:Game.GetSession(),building_id:this.building.id}, {
                                  success : function(o){
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 6 hrs to fix
                        app/js-yui/building/archaeology.js on lines 581..596

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

                        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

                            AbandonAllExcavators : function(e) {
                                if(confirm("Are you sure you want to abandon all excavators controlled by this Archaeology Ministry?")) {
                                    require('js/actions/menu/loader').show();
                                    this.service.mass_abandon_excavator({
                                            session_id:Game.GetSession(),
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 2 other locations - About 6 hrs to fix
                        app/js-yui/building/miningMinistry.js on lines 388..407
                        app/js-yui/building/observatory.js on lines 187..206

                        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

                                if(!this.glyphCombine) {
                                  this.glyphCombine = new Util.DDTarget("archaeologyGlyphCombine");
                                  this.glyphCombine.isGlyphContainer = true;
                                }
                                else {
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 5 hrs to fix
                        app/js-yui/building/archaeology.js on lines 481..493

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

                        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.glyphList) {
                                  this.glyphList = new Util.DDTarget("archaeologyGlyphDetails");
                                  this.glyphList.isGlyphContainer = true;
                                }
                                else {
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 5 hrs to fix
                        app/js-yui/building/archaeology.js on lines 494..506

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

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

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

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

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

                        Refactorings

                        Further Reading

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

                            searchQueue : 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/archaeology.js and 4 other locations - About 3 hrs to fix
                        app/js-yui/building/blackHoleGenerator.js on lines 407..417
                        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

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

                            _getExcavatorTab : function() {
                              this.excavatorTab = new YAHOO.widget.Tab({ label: "Excavators", content: [
                                '<div id="excavatorInfo"></div>',
                                '<div class="excavatorContainer">',
                                '  <div id="excavatorDetails">',
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 2 hrs to fix
                        app/js-yui/building/miningMinistry.js on lines 24..35

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

                          var Lang = YAHOO.lang,
                            Util = YAHOO.util,
                            DDM = Util.DragDropMgr,
                            Dom = Util.Dom,
                            Event = Util.Event,
                        Severity: Major
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 2 hrs to fix
                        app/js-yui/mapper.js on lines 8..16

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

                        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

                            viewAdd : function(e, matchedEl, container) { 
                              matchedEl.parentNode.removeChild(matchedEl);
                              Dom.get("archaeologyGlyphCombine").appendChild(matchedEl);
                            },
                        Severity: Minor
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 35 mins to fix
                        app/js-yui/building/archaeology.js on lines 546..549

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

                        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

                            viewRemove : function(e, matchedEl, container) { 
                              matchedEl.parentNode.removeChild(matchedEl);
                              Dom.get("archaeologyGlyphDetails").appendChild(matchedEl);
                            },
                        Severity: Minor
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 35 mins to fix
                        app/js-yui/building/archaeology.js on lines 542..545

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

                        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

                                    nLi.innerHTML = ['<img src="',Lib.AssetUrl,'star_system/',obj.body.image,'.png" />', obj.body.name].join('');
                        Severity: Minor
                        Found in app/js-yui/building/archaeology.js and 1 other location - About 35 mins to fix
                        app/js-yui/building/miningMinistry.js on lines 156..156

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

                        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