plainblack/Lacuna-Web-Client

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

Summary

Maintainability
F
1 mo
Test Coverage

File embassy.js has 1126 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna.buildings");

if (typeof YAHOO.lacuna.buildings.Embassy == "undefined" || !YAHOO.lacuna.buildings.Embassy) {
    
(function(){
Severity: Major
Found in app/js-yui/building/embassy.js - About 2 days to fix

    Function StashSubmit has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            StashSubmit : function() {
                var data = {
                        session_id: Game.GetSession(""),
                        building_id: this.building.id
                    },
    Severity: Major
    Found in app/js-yui/building/embassy.js - About 3 hrs to fix

      Function StashPopulate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              StashPopulate : function() {
                  /*        
                  "stash" : {"gold" : 4500},
                  "stored" : {"energy" : 40000},
                  "max_exchange_size" : 30000,
      Severity: Major
      Found in app/js-yui/building/embassy.js - About 2 hrs to fix

        Function MembersPopulate has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                MembersPopulate : function() {
                    var details = Dom.get("embassyMemberDetails");
                    if(details && this.alliance) {
                        var members = this.alliance.members,
                            ul = document.createElement("ul"),
        Severity: Minor
        Found in app/js-yui/building/embassy.js - About 1 hr to fix

          Function InvitesPopulate has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  InvitesPopulate : function() {
                      var details = Dom.get("embassyInvitesDetails");
                      if(details) {
                          var invites = this.invites,
                              ul = document.createElement("ul"),
          Severity: Minor
          Found in app/js-yui/building/embassy.js - About 1 hr to fix

            Function StashDonateAdd has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    StashDonateAdd : function(e, matchedEl, container){
                        var quantity = Lib.getSelectedOptionValue(matchedEl.previousSibling)*1,
                            li = matchedEl.parentNode,
                            c = Dom.get("embassyStashToDonate");
                        if(quantity && c) {
            Severity: Minor
            Found in app/js-yui/building/embassy.js - About 1 hr to fix

              Function StashExchangeAdd has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      StashExchangeAdd : function(e, matchedEl, container){
                          var quantity = Lib.getSelectedOptionValue(matchedEl.previousSibling)*1,
                              li = matchedEl.parentNode,
                              c = Dom.get("embassyStashToExchange");
                          if(quantity && c) {
              Severity: Minor
              Found in app/js-yui/building/embassy.js - About 1 hr to fix

                Function PendingPopulate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        PendingPopulate : function() {
                            var details = Dom.get("embassySendDetails");
                            if(details) {
                                var pendingInvites = this.pendingInvites,
                                    ul = document.createElement("ul"),
                Severity: Minor
                Found in app/js-yui/building/embassy.js - About 1 hr to fix

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

                          _getStashTab : function() {
                              this.stashTab = new YAHOO.widget.Tab({ label: "Stash", content: [
                              '<div id="embassyStashAnnounce"></div>',
                              '<div class="embassyStash yui-g">',
                              '    <div class="yui-g first">',
                  Severity: Minor
                  Found in app/js-yui/building/embassy.js - About 1 hr to fix

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

                            PropLineDetails : function(prop, sec) {
                                if(prop.status == "Passed" || prop.status == "Failed") {
                                    return ['<div style="margin-bottom:2px;">',
                                        '<div class="yui-gb">',
                                        '    <div class="yui-u first"><label>',prop.name,'</label></div>',
                    Severity: Minor
                    Found in app/js-yui/building/embassy.js - About 1 hr to fix

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

                              _getAllianceTab : function() {
                                  var div = document.createElement("div");
                                  if(this.isLeader) {
                                      div.innerHTML = ['<div>',
                                      '    <ul>',
                      Severity: Minor
                      Found in app/js-yui/building/embassy.js - About 1 hr to fix

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

                                _createSendToSelect : function() {
                                    var dataSource = new Util.XHRDataSource("/empire");
                                    dataSource.connMethodPost = "POST";
                                    dataSource.maxCacheEntries = 2;
                                    dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
                        Severity: Minor
                        Found in app/js-yui/building/embassy.js - About 1 hr to fix

                          Function InvitesAccept has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  InvitesAccept : function() {
                                      if(confirm(['Are you sure you want to accept the alliance invite from ', this.Invite.name,'?'].join(''))) {
                                          this.Self.service.accept_invite({
                                              session_id:Game.GetSession(""),
                                              building_id:this.Self.building.id,
                          Severity: Minor
                          Found in app/js-yui/building/embassy.js - About 1 hr to fix

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

                                    _getPropsTab : function() {
                                        var tab = new YAHOO.widget.Tab({ label: "Propositions", content: [
                                            '<div>',
                                            '    <div style="overflow:auto;"><ul id="propsDetails"></ul></div>',
                                            '</div>'
                            Severity: Minor
                            Found in app/js-yui/building/embassy.js - About 1 hr to fix

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

                                      CreateAlliance : function() {
                                          var data = {
                                              session_id: Game.GetSession(""),
                                              building_id: this.building.id,
                                              name: Dom.get("embassyCreateName").value
                              Severity: Minor
                              Found in app/js-yui/building/embassy.js - About 1 hr to fix

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

                                        PropsPopulate : function() {
                                            var details = Dom.get("propsDetails");
                                            
                                            if(details) {
                                                var props = this.props,
                                Severity: Minor
                                Found in app/js-yui/building/embassy.js - About 1 hr to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if(Lang.isArray(resource)) {
                                                              for(x=0; x < resource.length; x++) {
                                                                  name = resource[x];
                                                                  if(stash.stored[name]) {
                                                                      nLi = li.cloneNode(false);
                                  Severity: Major
                                  Found in app/js-yui/building/embassy.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if(Lang.isArray(resource)) {
                                                                for(x=0; x < resource.length; x++) {
                                                                    name = resource[x];
                                                                    if(stash.stash[name]) {
                                                                        nLi = li.cloneNode(false);
                                    Severity: Major
                                    Found in app/js-yui/building/embassy.js - About 45 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                      if (typeof YAHOO.lacuna.buildings.Embassy == "undefined" || !YAHOO.lacuna.buildings.Embassy) {
                                          
                                      (function(){
                                          var Lang = YAHOO.lang,
                                              Util = YAHOO.util,
                                      Severity: Major
                                      Found in app/js-yui/building/embassy.js - About 40 mins to fix

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

                                                StashDonateAdd : function(e, matchedEl, container){
                                                    var quantity = Lib.getSelectedOptionValue(matchedEl.previousSibling)*1,
                                                        li = matchedEl.parentNode,
                                                        c = Dom.get("embassyStashToDonate");
                                                    if(quantity && c) {
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 3 days to fix
                                        app/js-yui/building/embassy.js on lines 424..467

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

                                        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

                                                StashExchangeAdd : function(e, matchedEl, container){
                                                    var quantity = Lib.getSelectedOptionValue(matchedEl.previousSibling)*1,
                                                        li = matchedEl.parentNode,
                                                        c = Dom.get("embassyStashToExchange");
                                                    if(quantity && c) {
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 3 days to fix
                                        app/js-yui/building/embassy.js on lines 356..399

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

                                        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

                                                PropsPopulate : function() {
                                                    var details = Dom.get("propsDetails");
                                                    
                                                    if(details) {
                                                        var props = this.props,
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 2 days to fix
                                        app/js-yui/module/parliament.js on lines 1226..1266

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

                                        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(inStash && stash.stash) {
                                                        inStash.innerHTML = "";                
                                                        for(r in Lib.ResourceTypes) {
                                                            if(Lib.ResourceTypes.hasOwnProperty(r)) {
                                                                resource = Lib.ResourceTypes[r];
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 day to fix
                                        app/js-yui/building/embassy.js on lines 295..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 352.

                                        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(onPlanet) {
                                                        onPlanet.innerHTML = "";
                                                        
                                                        for(r in Lib.ResourceTypes) {
                                                            if(Lib.ResourceTypes.hasOwnProperty(r)) {
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 day to fix
                                        app/js-yui/building/embassy.js on lines 322..347

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

                                        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

                                                _getPropsTab : function() {
                                                    var tab = new YAHOO.widget.Tab({ label: "Propositions", content: [
                                                        '<div>',
                                                        '    <div style="overflow:auto;"><ul id="propsDetails"></ul></div>',
                                                        '</div>'
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 day to fix
                                        app/js-yui/module/parliament.js on lines 65..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 326.

                                        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

                                                formatBody : function(body) {
                                                    body = body.replace(/&/g,'&amp;');
                                                    body = body.replace(/</g,'&lt;');
                                                    body = body.replace(/>/g,'&gt;');
                                                    body = body.replace(/\n/g,'<br />');
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 2 other locations - About 1 day to fix
                                        app/js-yui/messaging.js on lines 1050..1070
                                        app/js-yui/module/parliament.js on lines 1374..1394

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

                                        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(confirm(['Are you sure you want to reject the alliance invite from ', this.Invite.name,'?'].join(''))) {                
                                                        this.Self.service.reject_invite({
                                                            session_id:Game.GetSession(""),
                                                            building_id:this.Self.building.id,
                                                            invite_id:this.Invite.id,
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 day to fix
                                        app/js-yui/building/embassy.js on lines 904..926

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

                                        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(confirm(['Are you sure you want to withdraw the invite from ', this.Invite.name].join(''))) {
                                                        this.Self.service.withdraw_invite({
                                                            session_id:Game.GetSession(""),
                                                            building_id:this.Self.building.id,
                                                            invite_id:this.Invite.id,
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 day to fix
                                        app/js-yui/building/embassy.js on lines 733..755

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

                                        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

                                                PropLineDetails : function(prop, sec) {
                                                    if(prop.status == "Passed" || prop.status == "Failed") {
                                                        return ['<div style="margin-bottom:2px;">',
                                                            '<div class="yui-gb">',
                                                            '    <div class="yui-u first"><label>',prop.name,'</label></div>',
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 day to fix
                                        app/js-yui/module/parliament.js on lines 1267..1303

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

                                        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

                                                PropVoteSuccess  : function(o){
                                                    this.Self.rpcSuccess(o);
                                                    var newProp = o.result.proposition;
                                                    for(var i=0; i<this.Self.props.length; i++) {
                                                        if(this.Self.props[i].id == newProp.id) {
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 6 hrs to fix
                                        app/js-yui/module/parliament.js on lines 1361..1372

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

                                        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", "Embassy.leave_alliance.success");
                                                                this.rpcSuccess(o);
                                                                delete this.alliance;
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 5 hrs to fix
                                        app/js-yui/building/embassy.js on lines 812..826

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

                                        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", "Embassy.dissolve_alliance.success");
                                                                this.rpcSuccess(o);
                                                                delete this.alliance;
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 5 hrs to fix
                                        app/js-yui/building/embassy.js on lines 790..804

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

                                        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

                                                PropQueue : function(remaining, elLine){
                                                    var arrTime;
                                                    if(remaining <= 0) {
                                                        arrTime = 'Overdue ' + Lib.formatTime(Math.round(-remaining));
                                                    }
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 4 hrs to fix
                                        app/js-yui/module/parliament.js on lines 1312..1327

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

                                        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(newTotal == 0) {
                                                            this.updateStashDonate(li.Object.quantity * -1);
                                                            Event.purgeElement(li);
                                                            li.parentNode.removeChild(li);
                                                        }
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 3 hrs to fix
                                        app/js-yui/building/embassy.js on lines 480..489

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

                                        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(newTotal == 0) {
                                                            this.updateStashExchange(li.Object.quantity * -1);
                                                            Event.purgeElement(li);
                                                            li.parentNode.removeChild(li);
                                                        }
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 3 hrs to fix
                                        app/js-yui/building/embassy.js on lines 412..421

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

                                        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

                                                PropClick : function(e, matchedEl, container){
                                                    var type = matchedEl.innerHTML;
                                                    if(type == "Yes" || type == "No") {
                                                        var el = Dom.getAncestorByTagName(matchedEl, "li"),
                                                            func = this["PropVote"+type];
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 3 hrs to fix
                                        app/js-yui/module/parliament.js on lines 1328..1338

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

                                        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

                                                handlePlanetLink : function(e, el) {
                                                    Event.stopEvent(e);
                                                    var res = el.href.match(/\#(-?\d+)$/);
                                                    this.hide();
                                                    var planet = Game.EmpireData.planets[res[1]];
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 3 hrs to fix
                                        app/js-yui/module/parliament.js on lines 1407..1414

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

                                        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

                                                PropVoteNo : function(prop, line) {
                                                    this.service.cast_vote({
                                                        session_id:Game.GetSession(""),
                                                        building_id:this.building.id,
                                                        proposition_id:prop.id,
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 3 other locations - About 3 hrs to fix
                                        app/js-yui/building/embassy.js on lines 1174..1184
                                        app/js-yui/module/parliament.js on lines 1339..1349
                                        app/js-yui/module/parliament.js on lines 1350..1360

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

                                                PropVoteYes : function(prop, line) {
                                                    this.service.cast_vote({
                                                        session_id:Game.GetSession(""),
                                                        building_id:this.building.id,
                                                        proposition_id:prop.id,
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 3 other locations - About 3 hrs to fix
                                        app/js-yui/building/embassy.js on lines 1185..1195
                                        app/js-yui/module/parliament.js on lines 1339..1349
                                        app/js-yui/module/parliament.js on lines 1350..1360

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

                                                    oTextboxList.generateRequest = function(sQuery){                
                                                        var s = Lang.JSON.stringify({
                                                                "id": YAHOO.rpc.Service._requestId++,
                                                                "method": "find",
                                                                "jsonrpc": "2.0",
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 6 other locations - About 2 hrs to fix
                                        app/js-yui/building/libraryOfJith.js on lines 60..71
                                        app/js-yui/building/templeOfTheDrajilites.js on lines 79..90
                                        app/js-yui/mapStar.js on lines 507..518
                                        app/js-yui/messaging.js on lines 260..271
                                        app/js-yui/module/parliament.js on lines 595..606
                                        app/js-yui/module/parliament.js on lines 629..640

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

                                        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

                                                                for(n=0; n<toExchangeLis.length; n++) {
                                                                    if(toExchangeLis[n].Object) {
                                                                        Event.purgeElement(toExchangeLis[n]);
                                                                        toExchangeLis[n].parentNode.removeChild(toExchangeLis[n]);
                                                                    }
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 2 hrs to fix
                                        app/js-yui/building/embassy.js on lines 560..565

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

                                        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

                                                                for(n=0; n<toDonateLis.length; n++) {
                                                                    if(toDonateLis[n].Object) {
                                                                        Event.purgeElement(toDonateLis[n]);
                                                                        toDonateLis[n].parentNode.removeChild(toDonateLis[n]);
                                                                    }
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 2 hrs to fix
                                        app/js-yui/building/embassy.js on lines 566..571

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

                                        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

                                                    for(n=0; n<toExchangeLis.length; n++) {
                                                        obj = toExchangeLis[n].Object;
                                                        if(obj) {
                                                            exchangeItems[obj.type] = obj.quantity;
                                                            exchangeTotal += obj.quantity;
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 2 hrs to fix
                                        app/js-yui/building/embassy.js on lines 514..520

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

                                        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

                                                    for(n=0; n<toDonateLis.length; n++) {
                                                        obj = toDonateLis[n].Object;
                                                        if(obj) {
                                                            donateItems[obj.type] = obj.quantity;
                                                            donateTotal += obj.quantity;
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 2 hrs to fix
                                        app/js-yui/building/embassy.js on lines 521..527

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

                                        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/embassy.js and 3 other locations - About 1 hr to fix
                                        app/js-yui/building/intelligence.js on lines 370..374
                                        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

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

                                                handleProfileLink : function(e, el) {
                                                    Event.stopEvent(e);
                                                    var res = el.href.match(/\#(-?\d+)$/);
                                                    if(res) {
                                                        Lacuna.Info.Empire.Load(res[1]);
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 2 other locations - About 1 hr to fix
                                        app/js-yui/messaging.js on lines 1071..1077
                                        app/js-yui/module/parliament.js on lines 1395..1401

                                        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

                                                    this.stashTab = new YAHOO.widget.Tab({ label: "Stash", content: [
                                                    '<div id="embassyStashAnnounce"></div>',
                                                    '<div class="embassyStash yui-g">',
                                                    '    <div class="yui-g first">',
                                                    '        <div class="yui-u first">',
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 hr to fix
                                        app/js-yui/building/distributionCenter.js on lines 26..55

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

                                                handleAllianceLink : function(e, el) {
                                                    Event.stopEvent(e);
                                                    var res = el.href.match(/\#(-?\d+)$/);
                                                    Lacuna.Info.Alliance.Load(res[1]);
                                                }
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 3 other locations - About 1 hr to fix
                                        app/js-yui/info.js on lines 107..111
                                        app/js-yui/messaging.js on lines 1091..1095
                                        app/js-yui/module/parliament.js on lines 1415..1419

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

                                        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

                                                PropVoteDetails : function(prop) {
                                                    if(prop.my_vote !== undefined) {
                                                        return '<label>Voted ' + (prop.my_vote*1 === 1 ? 'Yes' : 'No') + '</label>';
                                                    }
                                                    else {
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 1 hr to fix
                                        app/js-yui/module/parliament.js on lines 1304..1311

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

                                                    var oTextboxList = new YAHOO.lacuna.TextboxList("embassySendTo", dataSource, { //config options
                                                        maxResultsDisplayed: 10,
                                                        minQueryLength:3,
                                                        multiSelect:false,
                                                        forceSelection:true,
                                        Severity: Major
                                        Found in app/js-yui/building/embassy.js and 3 other locations - About 1 hr to fix
                                        app/js-yui/messaging.js on lines 251..259
                                        app/js-yui/stats.js on lines 664..672
                                        app/js-yui/stats.js on lines 905..913

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

                                        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

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

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

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

                                        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

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

                                                                this.Self.isLeader = this.Self.alliance && this.Self.alliance.leader_id == Game.EmpireData.id;
                                        Severity: Minor
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 50 mins to fix
                                        app/js-yui/building/embassy.js on lines 1046..1046

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

                                        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.memberTab = new YAHOO.widget.Tab({ label: "Members", content: ['<div>',
                                                    '    <ul class="embassyHeader embassyInfo clearafter">',
                                                    '        <li class="embassyEmpire">Empire</li>',
                                                    '        <li class="embassyAction"></li>',
                                                    '        <li class="embassyMessage"></li>',
                                        Severity: Minor
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 50 mins to fix
                                        app/js-yui/building/observatory.js on lines 33..42

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

                                        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

                                                                this.Self.isLeader = this.Self.alliance && this.Self.alliance.leader_id == Game.EmpireData.id;
                                        Severity: Minor
                                        Found in app/js-yui/building/embassy.js and 1 other location - About 50 mins to fix
                                        app/js-yui/building/embassy.js on lines 720..720

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

                                        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.service.leave_alliance({
                                                            session_id:Game.GetSession(""),
                                                            building_id:this.building.id,
                                                            message:Dom.get("embassyAllianceLeaveReason").value
                                                        }, {
                                        Severity: Minor
                                        Found in app/js-yui/building/embassy.js and 2 other locations - About 30 mins to fix
                                        app/js-yui/building/embassy.js on lines 591..595
                                        app/js-yui/module/parliament.js on lines 649..653

                                        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

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

                                                    var data = {
                                                        session_id: Game.GetSession(""),
                                                        building_id: this.building.id,
                                                        name: Dom.get("embassyCreateName").value
                                                    };
                                        Severity: Minor
                                        Found in app/js-yui/building/embassy.js and 2 other locations - About 30 mins to fix
                                        app/js-yui/building/embassy.js on lines 786..790
                                        app/js-yui/module/parliament.js on lines 649..653

                                        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