Showing 509 of 1,320 total issues
Function AddResource
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
AddResource : function(e, matchedEl, container){
var quantity = matchedEl.previousSibling.value*1,
li = matchedEl.parentNode,
c = Dom.get("tradeAddItems");
if(quantity && c) {
Function ReserveStoreAdd
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ReserveStoreAdd : function(e, matchedEl, container){
var quantity = matchedEl.previousSibling.value*1,
li = matchedEl.parentNode,
c = Dom.get("distribReserveToStore");
if(quantity && c) {
Function authenticateChat
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
authenticateChat : function() {
// Only do this process once.
// NOTE: it's checked before but we're just making sure. (nice rhyming)
if (this.hasRenderedChat === true) {
Function titleCaps
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
String.prototype.titleCaps = function(replaceVal, withVal){
var parts = [], split = /[:.;?!] |(?: |^)["�]/g, index = 0, processVal = this;
var fnUpper = function(all){
return (/[A-Za-z]\.[A-Za-z]/).test(all) ? all : String.upper(all);
},
- Read upRead up
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 _getBodiesHtml
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_getBodiesHtml : function() {
var data = this._serverOverview.bodies;
return [
'<ul class="statsList">',
'<li><label>Total Bodies:</label>', Lib.formatNumber(data.count), '</li>',
Function _getPushTab
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_getPushTab : function() {
this.push = new YAHOO.widget.Tab({ label: "Push", content: [
'<div id="pHt"><div class="tradeStash yui-g">',
' <div class="yui-u first">',
' <legend>On Planet</legend>',
Function InvitesPopulate
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
InvitesPopulate : function() {
var details = Dom.get("embassyInvitesDetails");
if(details) {
var invites = this.invites,
ul = document.createElement("ul"),
Function speciesDisplay
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
speciesDisplay : function(stat) {
this.species.innerHTML = [
'<li style="border-bottom:1px solid #52ACFF;font-size:120%;"><label>',stat.name,'</label></li>',
'<li style="padding-bottom:5px;">', stat.description, '</li>',
'<li>',
Function MembersPopulate
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MembersPopulate : function() {
var details = Dom.get("embassyMemberDetails");
if(details && this.alliance) {
var members = this.alliance.members,
ul = document.createElement("ul"),
Function Mapper
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Mapper : function(oArgs) {
//YAHOO.log(oArgs.buildings, "debug", "Mapper");
this.buildings = oArgs.buildings;
this.surfaceUrl = [Lib.AssetUrl,'planet_side/',oArgs.body.surface_image,'.jpg'].join('');
Dom.setStyle("buildingDetailsImgBkgd","background",['transparent url(',this.surfaceUrl,') no-repeat left top'].join(''));
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render : function() {
var building = this.state.genericBuildingStore;
var body = this.state.body;
return (
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render : function() {
return (
<div className="ui right vertical inverted sidebar menu" ref="sidebar">
<div ref="header" style={{paddingTop : 7}}>
Function _createSliders
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_createSliders : function() {
this.speciesHO = this._createHabitableOrbits();
this.speciesConst = this._createHorizSingle("speciesConst", "speciesConst_thumb", "speciesConst_num");
this.speciesDecep = this._createHorizSingle("speciesDecep", "speciesDecep_thumb", "speciesDecep_num");
this.speciesResearch = this._createHorizSingle("speciesResearch", "speciesResearch_thumb", "speciesResearch_num");
Function CreateFind
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
CreateFind : function() {
if(!this.findStar) {
var dataSource = new Util.XHRDataSource("/map");
dataSource.connMethodPost = "POST";
dataSource.maxCacheEntries = 2;
Function populateSpies
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
populateSpies : function(tab) {
var list = tab.elSpiesList;
var spies = tab.avail.spies;
var ships = tab.avail.spyShips;
var verb = tab.id == 'planetDetailSendSpies' ? 'send' : 'fetch';
Function _getHtml
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_getHtml : function() {
var Ht = Game.GetSize().h - 140;
if(Ht > 300) { Ht = 300; }
return [
' <div class="hd">Empire</div>',
Function _createPanel
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_createPanel : function() {
if(!this.Panel) {
var container = document.createElement("div");
container.id = this.id;
Dom.addClass(container, Lib.Styles.HIDDEN);
Function updateDisplay
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateDisplay : function(exp) {
Dom.get("geneticsLabSurvival").innerHTML = exp.survival_odds;
Dom.get("geneticsLabGraft").innerHTML = exp.graft_odds;
Dom.get("geneticsLabCost").innerHTML = exp.essentia_cost;
Dom.removeClass(Sel.query("li.selected", "geneticsLabSpies"),"selected");
Function createFind
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.starFind.createFind = function() {
var dataSource = new Util.XHRDataSource("/map");
dataSource.connMethodPost = "POST";
dataSource.maxCacheEntries = 2;
dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
Function handleLogin
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleLogin : function() {
require('js/actions/menu/loader').show();
this.setMessage("");
var EmpireServ = Game.Services.Empire;
new Fingerprint2().get(_.bind(function(result){