Showing 82 of 157 total issues
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(player) {
var socket = player.getSocket();
this.emit = function(name, msg) {
socket.emit(name, msg);
};
Function draw
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.draw = function(ctx) {
ctx.font = '12px Arial';
ctx.beginPath();
ctx.rect(this.x,this.y,this.width,this.height);
if(this.clicked) {
Function draw
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.draw = function(ctx) {
if(this.visible) {
ctx.beginPath();
ctx.rect(this.x,this.y,this.width,this.height);
ctx.fillStyle = '#8ED6FF';
Function AuctionCard
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function AuctionCard(id,title,text,x,y,profitConfig,range,localLevelMod,type,ctx) {
this.Inherits(BaseCard);
this.id = id;
this.title = title;
this.text = text;
- 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 onclick
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
CanvasManagerUIMode.prototype.onclick = function(x,y) {
if(this.enabled) {
for(var i = this.elements.length - 1 ; i>= 0 ; i--) {
var ele = this.elements[i][2];
if(typeof(ele.onclick) === 'function' && ele.onclick(x,y)) {
- 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 onTurnDone
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.onTurnDone = function() {
this.showWaitOverlay();
G.turnDoneButton.enabled = false;
if(G.gameState == 1) {
socket.emit('roundEnd_req', { playerId : G.playerId});
Function removePlayer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Game.removePlayer = function(socketId, onSuccess, onGameDeleted) {
var PlayerManager = require('./rule_playermanager.js');
var GameManager = require('./rule_gamemanager.js');
PlayerManager.getPlayerBySocketId(socketId, function(player) {
GameManager.getGame(player.gameId, function(game) {
Function moveover
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.moveover = function(x,y) {
if(!this.selectTargetEnabled) {
return;
}
for(var i = 0 ; i < this.allElements.length ; i++) {
Function playCard
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Player.prototype.playCard = function(cardIdToPlay,targetFieldId,onSuccess,onFail) {
// check if player is able to deploy a card this turn
if(this.availableActions & 1 == 0) {
logger.debug("[playCard] availableActions="+this.availableActions+", return from playCard");
return;
Function calcRanges
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.calcRanges = function(type) {
for(var i = 0 ; i < this.allElements.length ; i++) {
var field = this.allElements[i];
if(field.type == 0 ) {
field.influenced = 0;
Function draw
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
UIElement.prototype.draw = function(ctx, relocateX, relocateY) {
ctx.beginPath();
// get the background-color
if(this.fillStyleH != null) {
- 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 calcLocalLevel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
RentalCard.prototype.calcLocalLevel = function(field, fields, changedFields) {
Card.forEachField(this.range, field, fields, function(surroundingElement) {
if(surroundingElement.type == FieldType.HOUSE) {
if(typeof this.changeLocalLevel !== 'undefined') {
if(this.changeLocalLevel(surroundingElement)) {
- 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 processAuctionBid
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Game.prototype.processAuctionBid = function(allPlayers) {
logger.debug("[processAuctionBid] start. this.biddings=%j", this.biddings);
this.gameState = GameStates.PICK_CARD;
// if a player had left the game and rejoined again his bidding is undefined. So tread this as $0.
- 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 storePlayer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
storePlayer : function(player, prepare, onSuccess) {
if(prepare!=null) {
prepare(player);
}
db.insert(player, function(err, body) {
- 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
for(var j = pf.ht[0] ; j <= pf.ht[1] ; j++) {
if(j!==pf.ht[0]) {
text += " / ";
}
text += UIServices.getHouseTypeText(j);
Avoid deeply nested control flow statements. Open
if(this.cardsToAuction[j].cardsToSelect[i].id == cardId) {
c = this.cardsToAuction[j].cardsToSelect[i];
}
Function RentalCard
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function RentalCard(id,no,range,type,profitConfig,localLevelMod) {
Function calcSupplies
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
RentalCard.prototype.calcSupplies = function(field, fields) {
Card.forEachField(this.range, field, fields, function(surroundingElement) {
if(surroundingElement.type == FieldType.HOUSE) {
if(typeof surroundingElement.attachedCard.supply[RentalCard.getTypeFromField(field)] === 'undefined') {
surroundingElement.attachedCard.supply[RentalCard.getTypeFromField(field)] = 0;
- 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
for(var k = start ; k <= end ; k++) {
if(k!==start) {
tempTxtDisp += " / ";
}
tempTxtDisp += UIServices.getHouseTypeText(k);
Function getButton
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
CanvasManager.prototype.getButton = function(x,y) {
if(this.enabled) {
for(var i = this.elements.length - 1 ; i>= 0 ; i--) {
var ele = this.elements[i][2];
if(typeof(ele.atPos) === 'function' && ele.atPos(x,y)) {
- 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"