plainblack/Lacuna-Web-Client

View on GitHub

Showing 509 of 1,320 total issues

Function ViewActionDetails has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        ViewActionDetails : function(nLi, ship, noEvent) {
            var ulDet = ['<li style="white-space:nowrap;"><label style="font-weight:bold;">',ship.task,'</label></li>'];

            if(ship.task === "Docked") {
                ulDet[ulDet.length] = '<li style="white-space:nowrap;margin-top:5px"><button type="button" class="scuttle">Scuttle</button></li>';
Severity: Minor
Found in app/js-yui/building/spacePort.js - About 1 hr to fix

    Function NewsGet has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            NewsGet : function() {
                require('js/actions/menu/loader').show();
                this.service.view_news({session_id:Game.GetSession(),building_id:this.building.id}, {
                    success : function(o){
                        YAHOO.log(o, "info", "Network19.NewsGet.success");
    Severity: Minor
    Found in app/js-yui/building/network19.js - About 1 hr to fix

      Function render has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render : function() {
              var destructMs          = this.state.empireRPCStore.self_destruct_ms;
              var destructActive      = this.state.empireRPCStore.self_destruct_active && destructMs > 0;
              var formattedDestructMs = destructActive ? util.formatMillisecondTime(destructMs) : '';
      
      
      Severity: Minor
      Found in app/js/components/menu/leftSidebar.jsx - About 1 hr to fix

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

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

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

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

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

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

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

                      Rename : function() {
                          var newName = Dom.get("commandPlanetNewName").value,
                              cp = Game.GetCurrentPlanet(),
                              planetId = cp.id;
                          Game.Services.Body.rename({
              Severity: Minor
              Found in app/js-yui/building/planetaryCommand.js - About 1 hr to fix

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

                        Dump : function(e) {
                            var planet = Game.GetCurrentPlanet();
                            var building = this.building;
                            var type = "water";
                            if(building) {
                Severity: Minor
                Found in app/js-yui/building/waterStorage.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 Dump has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            Dump : function(e) {
                                var planet = Game.GetCurrentPlanet();
                                var building = this.building;
                                var type = "energy";
                                if(building) {
                    Severity: Minor
                    Found in app/js-yui/building/energyReserve.js - About 1 hr to fix

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

                          render           : function() {
                      
                              // console.log(this.state);
                      
                              // Do nothing if the menu isn't shown.
                      Severity: Minor
                      Found in app/js/components/menu/map.jsx - About 1 hr to fix

                        Function sendRequest has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var sendRequest = function(url, data, options, retry) {
                            console.log('Calling', options.module + '/' + options.method, options.params);
                        
                            $.ajax({
                                data     : data,
                        Severity: Minor
                        Found in app/js/server.js - About 1 hr to fix

                          Function resourceOptionsHTML has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  resourceOptionsHTML : function(selected) {
                                      var resource_options = "";
                              
                                      for(r in Lib.ResourceTypes) {
                                          if(Lib.ResourceTypes.hasOwnProperty(r)) {
                          Severity: Minor
                          Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                            Function _getLabTab has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    _getLabTab : function() {
                                        this.tab = new YAHOO.widget.Tab({ label: "Lab", content: [
                                            '<table class="tleTable">',
                                            '    <tr>',
                                            '        <th>Survival Chance</th><th>Graft Success</th><th>Essentia Cost</th>',
                            Severity: Minor
                            Found in app/js-yui/building/geneticsLab.js - About 1 hr to fix

                              Function _getAddTradeTab has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              _getAddTradeTab : function() {
                                               this.add = new YAHOO.widget.Tab({ label: "Add Trade", content: [
                                                       '<div id="aHt"><div class="tradeStash yui-g">',
                                                       '    <div class="yui-u first">',
                                                       '        <legend>On Planet</legend>',
                              Severity: Minor
                              Found in app/js-yui/building/tradeMinistry.js - About 1 hr to fix

                                Function _getReserveTab has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        _getReserveTab : function() {
                                            this.tab = new YAHOO.widget.Tab({ label: "Reserve", content: [
                                            '<div id="distribReserveAnnounce"></div>',
                                            '<div id="distribReserveContainers" style="display:none;">',
                                            '    <div class="distribReserve yui-g">',
                                Severity: Minor
                                Found in app/js-yui/building/distributionCenter.js - About 1 hr to fix

                                  Function ReservePopulate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          ReservePopulate : function() {
                                              var reserve = this.result.reserve || {}, 
                                                  onPlanet = Dom.get("distribReserveOnPlanet"),
                                                  announce = Dom.get("distribReserveAnnounce"),
                                                  li = document.createElement("li"), nLi, ul,
                                  Severity: Minor
                                  Found in app/js-yui/building/distributionCenter.js - About 1 hr to fix

                                    Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        render : function() {
                                            var tabTitles = [];
                                            var tabContents = [];
                                    
                                            React.Children.forEach(this.props.children, function(child) {
                                    Severity: Minor
                                    Found in app/js/components/tabber/tabs.jsx - About 1 hr to fix

                                      Function reduceNumber has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      module.exports.reduceNumber = function(number, always) {
                                          if (number >= 100000000000000000 || number <= -100000000000000000) {
                                              // 101Q
                                              return Math.floor(number / 1000000000000000) + 'Q';
                                          } else if (number >= 1000000000000000 || number <= -1000000000000000) {
                                      Severity: Minor
                                      Found in app/js/util.js - About 1 hr to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Function _getSpiesHtml has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      _getSpiesHtml : function() {
                                                          var data = this._serverOverview.spies;
                                                          return ['<ul class="statsList">',
                                                                 '<li><label>Total Spies:</label>', Lib.formatNumber(data.count), '</li>',
                                                                 '<li><label>Average Defense:</label>', Lib.formatNumber(data.average_defense), '</li>',
                                      Severity: Minor
                                      Found in app/js-yui/stats.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language