plainblack/Lacuna-Web-Client

View on GitHub
app/js-yui/info.js

Summary

Maintainability
D
1 day
Test Coverage

File info.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

YAHOO.namespace("lacuna");

var _ = require('lodash');


Severity: Minor
Found in app/js-yui/info.js - About 2 hrs to fix

    Function Load has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            Load : function(empireId) {
                this._createPanel();
    
                require('js/actions/menu/loader').show();
                Game.Services.Empire.view_public_profile({session_id:Game.GetSession(""),empire_id:empireId},{
    Severity: Major
    Found in app/js-yui/info.js - About 2 hrs to fix

      Function success has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      success:function(o){
                          require('js/actions/menu/loader').hide();
                          var profile = o.result.profile;
                          this.currentEmpire = profile;
                          this.empire.innerHTML = profile.name;
      Severity: Major
      Found in app/js-yui/info.js - About 2 hrs to fix

        Function _getHtml has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _getHtml : function() {
                    var Ht = Game.GetSize().h - 140;
                    if(Ht > 300) { Ht = 300; }
                    return [
                    '    <div class="hd">Empire</div>',
        Severity: Minor
        Found in app/js-yui/info.js - About 1 hr to fix

          Function _createPanel has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _createPanel : function() {
                      if(!this.Panel) {
                          var container = document.createElement("div");
                          container.id = this.id;
                          Dom.addClass(container, Lib.Styles.HIDDEN);
          Severity: Minor
          Found in app/js-yui/info.js - About 1 hr to fix

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

                    _createPanel : function() {
                        if(!this.Panel) {
                            var container = document.createElement("div");
                            container.id = this.id;
                            Dom.addClass(container, Lib.Styles.HIDDEN);
            Severity: Minor
            Found in app/js-yui/info.js - About 1 hr to fix

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

                      EmpireInfo : function(e, el) {
                          Event.stopEvent(e);
                          var res = el.href.match(/\#(\d+)$/);
                          Lacuna.Info.Empire.Load(res[1]);
                      }
              Severity: Major
              Found in app/js-yui/info.js and 3 other locations - About 1 hr to fix
              app/js-yui/building/embassy.js on lines 1250..1254
              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

              There are no issues that match your filters.

              Category
              Status