Showing 509 of 1,320 total issues
Function ViewActionDetails
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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>';
Function NewsGet
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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");
Function render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) : '';
Function EmpireFindCreate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
EmpireFindCreate : function() {
var dataSource = new Util.XHRDataSource("/stats");
dataSource.connMethodPost = "POST";
dataSource.maxCacheEntries = 2;
dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
Function AllianceFindCreate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
AllianceFindCreate : function() {
var dataSource = new Util.XHRDataSource("/stats");
dataSource.connMethodPost = "POST";
dataSource.maxCacheEntries = 2;
dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
Function PopulateBHGResult
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
PopulateBHGResult : function(target, effect) {
var details = Dom.get("bhgResult"),
detailsParent = details.parentNode,
li = document.createElement("li");
Function Rename
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Rename : function() {
var newName = Dom.get("commandPlanetNewName").value,
cp = Game.GetCurrentPlanet(),
planetId = cp.id;
Game.Services.Body.rename({
Function Dump
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Dump : function(e) {
var planet = Game.GetCurrentPlanet();
var building = this.building;
var type = "water";
if(building) {
Function _getStashTab
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
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">',
Function Dump
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Dump : function(e) {
var planet = Game.GetCurrentPlanet();
var building = this.building;
var type = "energy";
if(building) {
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render : function() {
// console.log(this.state);
// Do nothing if the menu isn't shown.
Function sendRequest
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var sendRequest = function(url, data, options, retry) {
console.log('Calling', options.module + '/' + options.method, options.params);
$.ajax({
data : data,
Function resourceOptionsHTML
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
resourceOptionsHTML : function(selected) {
var resource_options = "";
for(r in Lib.ResourceTypes) {
if(Lib.ResourceTypes.hasOwnProperty(r)) {
Function _getLabTab
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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>',
Function _getAddTradeTab
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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>',
Function _getReserveTab
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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">',
Function ReservePopulate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ReservePopulate : function() {
var reserve = this.result.reserve || {},
onPlanet = Dom.get("distribReserveOnPlanet"),
announce = Dom.get("distribReserveAnnounce"),
li = document.createElement("li"), nLi, ul,
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render : function() {
var tabTitles = [];
var tabContents = [];
React.Children.forEach(this.props.children, function(child) {
Function reduceNumber
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
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) {
- 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 _getSpiesHtml
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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>',