Showing 509 of 1,320 total issues
Avoid deeply nested control flow statements. Open
Open
if(Dom.getStyle("tradeAddGlyphSummaryName", "display") == "none") {
Dom.setStyle("tradeAddGlyphSummaryName", "display", "block");
this.getGlyphSummary();
}
else {
Avoid deeply nested control flow statements. Open
Open
if(rf <= 0) {
elm.innerHTML = "";
YAHOO.log("Complete","info","buildingDetails.showEvent.BuildTimeRemaining");
this.DetailsView({data:{id:building.id,url:building.url},x:building.x,y:building.y});
}
Avoid deeply nested control flow statements. Open
Open
if(this.resultTypeList) {
// Results need to be converted back to an array
var aResult = [];
// Match key is first
aResult[0] = (YAHOO.lang.isString(oResult)) ? oResult : oResult[sMatchKey] || oResult[this.key];
Avoid deeply nested control flow statements. Open
Open
if(curNum != orig.length) {
isDirty = true;
}
Avoid deeply nested control flow statements. Open
Open
if(Dom.getStyle("tradePushGlyphSummaryName", "display") == "none") {
Dom.setStyle("tradePushGlyphSummaryName", "display", "block");
this.getGlyphSummary();
}
else {
Avoid deeply nested control flow statements. Open
Open
if(Lang.isArray(resource)) {
for(x=0; x < resource.length; x++) {
name = resource[x];
if(this.resources[name]) {
nLi = li.cloneNode(false);
Avoid deeply nested control flow statements. Open
Open
for(var i=1; i<tbl.length; i++) {
var row = tbl[i];
tblOut.push("<tr>");
for(var d=0; d<row.length; d++) {
tblOut.push("<td>");
Avoid deeply nested control flow statements. Open
Open
else if(resource) {
resource_options += [
'<option value="', r, '"'
].join('');
Avoid deeply nested control flow statements. Open
Open
if(reason[2]) {
output = [reason[1], ' Requires higher production of ', (Lang.isArray(reason[2]) ? reason[2].join(', ') : reason[2])].join('');
}
else {
output = reason[1];
Avoid deeply nested control flow statements. Open
Open
if (planet.water_stored > planet.water_capacity) {
planet.water_stored = planet.water_capacity;
} else if (planet.water_stored < 0) {
if (isNotStation) {
planet.happiness += planet.water_stored;
Avoid deeply nested control flow statements. Open
Open
for (var id in qt) {
if (qt.hasOwnProperty(id)) {
var ms = qt[id] - tickMS;
if (ms <= 0) {
toFire[id] = type;
Avoid deeply nested control flow statements. Open
Open
if (planet.energy_stored > planet.energy_capacity) {
planet.energy_stored = planet.energy_capacity;
} else if (planet.energy_stored < 0) {
if (isNotStation) {
planet.happiness += planet.energy_stored;
Avoid deeply nested control flow statements. Open
Open
if (planet.food_stored > planet.food_capacity) {
planet.food_stored = planet.food_capacity;
} else if (planet.food_stored < 0) {
if (isNotStation) {
planet.happiness += planet.food_stored;
Function renderChat
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
renderChat : function() {
// Only do this process once.
// NOTE: it's checked before but we're just making sure. (nice rhyming)
if (this.hasRenderedChat === true) {
- 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
Avoid deeply nested control flow statements. Open
Open
if (planet.ore_stored > planet.ore_capacity) {
planet.ore_stored = planet.ore_capacity;
} else if (planet.ore_stored < 0) {
if (isNotStation) {
planet.happiness += planet.ore_stored;
Avoid deeply nested control flow statements. Open
Open
if (planet.waste_stored > planet.waste_capacity) {
wasteOverage = planet.waste_stored - planet.waste_capacity;
planet.waste_stored = planet.waste_capacity;
} else if (planet.waste_stored < 0) {
if (isNotStation) {
Function getResourceStatus
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
getResourceStatus : function(hour, stored, capicity, hasCapicity) {
// Different players have differnet strategies regarding waste. Some would consider full
// waste good. Some would consider empty waste good. Therefore, we shouldn't comment
// on what a player does or does not do with their waste.
if (this.props.type === 'waste') {
- 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
Avoid deeply nested control flow statements. Open
Open
if (status.empire.planets.hasOwnProperty(pKey)) {
var ePlanet = Lacuna.Game.EmpireData.planets[pKey];
if (!ePlanet) {
Lacuna.Game.EmpireData.planets[pKey] = {
id : pKey,
Avoid deeply nested control flow statements. Open
Open
if (planet.happiness < 0 && ED.is_isolationist === '1') {
planet.happiness = 0;
}
Consider simplifying this complex logical expression. Open
Open
if (typeof YAHOO.lacuna.Mapper == "undefined" || !YAHOO.lacuna.Mapper) {
(function(){
var Lang = YAHOO.lang,
Util = YAHOO.util,