plainblack/Lacuna-Web-Client

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

Summary

Maintainability
F
5 days
Test Coverage

File intelligence.js has 550 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

if (typeof YAHOO.lacuna.buildings.Intelligence == "undefined" || !YAHOO.lacuna.buildings.Intelligence) {
    
(function(){
Severity: Major
Found in app/js-yui/building/intelligence.js - About 1 day to fix

    Function SpyInfo has 145 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            SpyInfo : function(spy) {
                var assign = spy.possible_assignments,
                    div = document.createElement("div"),
                    ul = document.createElement("ul"),
                    li = document.createElement("li"),
    Severity: Major
    Found in app/js-yui/building/intelligence.js - About 5 hrs to fix

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

              SpyAssign : function() {
                  require('js/actions/menu/loader').show();
                  var assign = this.Assign[this.Assign.selectedIndex].value;
                  
                  this.Self.service.assign_spy({
      Severity: Minor
      Found in app/js-yui/building/intelligence.js - About 1 hr to fix

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

                SpyPopulate : function() {
                    var details = Dom.get("spiesDetails");
                    if(details) {
                        var spies = this.spies.spies,
                            nDiv,
        Severity: Minor
        Found in app/js-yui/building/intelligence.js - About 1 hr to fix

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

                  _getTrainTab : function() {
                      var spies = this.result.spies;
                      this.trainTab = new YAHOO.widget.Tab({ label: "Train Spies", content: [
                          '<div class="yui-g">',
                          '    <div class="yui-u first">',
          Severity: Minor
          Found in app/js-yui/building/intelligence.js - About 1 hr to fix

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

                    spiesView : function(e) {
                        if(e.newValue) {
                            if(!this.spies) {
                                require('js/actions/menu/loader').show();
                                this.service.view_spies({session_id:Game.GetSession(),building_id:this.building.id}, {
            Severity: Minor
            Found in app/js-yui/building/intelligence.js - About 1 hr to fix

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

                      SpyNameSave : function(e) {
                          Event.stopEvent(e);
                          require('js/actions/menu/loader').show();
                          var newName = this.Input.value;
                          
              Severity: Minor
              Found in app/js-yui/building/intelligence.js - About 1 hr to fix

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

                        SpyName : function() {
                            this.el.innerHTML = "";
                            
                            var inp = document.createElement("input"),
                                bSave = document.createElement("button"),
                Severity: Major
                Found in app/js-yui/building/intelligence.js and 1 other location - About 1 day to fix
                app/js-yui/building/spacePort.js on lines 673..695

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

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

                    var Lang = YAHOO.lang,
                        Util = YAHOO.util,
                        Dom = Util.Dom,
                        Event = Util.Event,
                        Pager = YAHOO.widget.Paginator,
                Severity: Major
                Found in app/js-yui/building/intelligence.js and 6 other locations - About 2 hrs to fix
                app/js-yui/building/libraryOfJith.js on lines 6..14
                app/js-yui/building/observatory.js on lines 6..14
                app/js-yui/building/security.js on lines 6..14
                app/js-yui/building/templeOfTheDrajilites.js on lines 6..14
                app/js-yui/messaging.js on lines 12..20
                app/js-yui/module/policeStation.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 2 locations. Consider refactoring.
                Open

                            }, {
                                success : function(o){
                                    YAHOO.log(o, "info", "Intelligence.SpyHandlePagination.view_spies.success");
                                    require('js/actions/menu/loader').hide();
                                    this.rpcSuccess(o);
                Severity: Major
                Found in app/js-yui/building/intelligence.js and 1 other location - About 2 hrs to fix
                app/js-yui/building/shipyard.js on lines 106..115

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

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

                        handleStarmapLink : function(e, el) {
                            Event.stopEvent(e);
                            var res = el.href.match(/\#(-?\d+)x(-?\d+)$/);
                            Game.StarJump({x:res[1],y:res[2]});
                        },
                Severity: Major
                Found in app/js-yui/building/intelligence.js and 3 other locations - About 1 hr to fix
                app/js-yui/building/embassy.js on lines 1237..1241
                app/js-yui/messaging.js on lines 1078..1082
                app/js-yui/module/parliament.js on lines 1402..1406

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 72.

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

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

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

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

                Refactorings

                Further Reading

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

                        destroy : function() {
                            if(this.pager) {
                                this.pager.destroy();
                            }
                            Intelligence.superclass.destroy.call(this);
                Severity: Minor
                Found in app/js-yui/building/intelligence.js and 1 other location - About 55 mins to fix
                app/js-yui/building/observatory.js on lines 23..28

                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

                            nLi.innerHTML = '<label>Assigned To:</label> <a class="starmap_link" href="#' + spy.assigned_to.x + 'x' + spy.assigned_to.y + '">' + spy.assigned_to.name + '</a>';
                Severity: Minor
                Found in app/js-yui/building/intelligence.js and 1 other location - About 40 mins to fix
                app/js-yui/mapStar.js on lines 1259..1259

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

                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.Self.service.name_spy({
                                session_id:Game.GetSession(),
                                building_id:this.Self.building.id,
                                spy_id:this.Spy.id,
                                name:newName
                Severity: Minor
                Found in app/js-yui/building/intelligence.js and 1 other location - About 40 mins to fix
                app/js-yui/building/spacePort.js on lines 701..706

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

                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.renameTab = new YAHOO.widget.Tab({ label: "Rename All", content: [
                                '<div>',
                                '  <p>Prefix: <input id="spiesRenamePrefix" type="text" /> Suffix: <input id="spiesRenameSuffix" type="text" /> Rename Agent Null only: <input id="spiesNullOnly" type="checkbox" /> <button id="spiesRename" type="button">Rename All</button></p>',
                                '  <p>This will rename all spies managed by this planet at once to have the prefix and/or suffix you specify. A two-digit number, from 01 to the number of spies you have, will be placed after the prefix / before the suffix.</p>',
                                '  <p>If you specify Agent Null only, then only those spies will be renamed, even if the name does not otherwise fit your prefix and suffix, otherwise all spies will be normalised to this naming scheme.</p>',
                Severity: Minor
                Found in app/js-yui/building/intelligence.js and 1 other location - About 40 mins to fix
                app/js-yui/building/spacePort.js on lines 45..52

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

                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

                                failure : function(o){
                                    if(this.Input) {
                                        this.Input.value = this.Spy.name;
                                    }
                                },
                Severity: Minor
                Found in app/js-yui/building/intelligence.js and 1 other location - About 30 mins to fix
                app/js-yui/building/spacePort.js on lines 719..723

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

                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