Showing 18 of 48 total issues
Function getScenario
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
getScenario() {
var circumradius = hexInfo.circumradius;
var apothem = hexInfo.apothem;
var layout = this.getLayout();
var numberTokens = layout.numberTokens;
File index.js
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var _ = require('underscore');
var BaseController = require('./base');
Function initRoad
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
initRoad: function(req, next) {
var board = this.game.board;
var ownedEdges = board.edges.query({ owner: req.player });
var distributeResources = ownedEdges.length === 1;
var data = {};
Function getTileLayout
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
getTileLayout(layout) {
var circumradius = hexInfo.circumradius;
var apothem = hexInfo.apothem;
var tiles = layout.tiles.map(function(row) {
Function serializeBoard
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
serializeBoard(board) {
var tiles = board.tiles.map(function(tile) {
return {
id: tile.id,
center: tile.center,
Function getBuildableEdgesForPlayer
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBuildableEdgesForPlayer(player, cornerId) {
if (this.phase === 'setup') {
var corner;
if (cornerId != null) {
Function deserializeBoard
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
deserializeBoard(data) {
var board = this.factory.createBoard({
height: data.height,
width: data.width,
hexInfo: data.hex
Function deserializePlayer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
deserializePlayer(data, index) {
var player = this.factory.createPlayer({
id: data.id,
index: index
});
- 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 hasAllowance
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
hasAllowance: function(object) {
return function(req, next) {
var objects = [];
var yes = false;
Function constructor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructor(options, done) {
var factory = options.factory || new Factory();
this.gameSerializer = new GameSerializer(factory);
this.game = this.gameSerializer.deserialize(options.game);
- 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 processEdges
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
processEdges(board, edges) {
var edges1 = _.chain(edges)
.map(function(edge) {
return {
center: edge.center,
Function deserializePlayer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
deserializePlayer(data, index) {
var player = this.factory.createPlayer({
id: data.id,
index: index
});
Function getTasks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getTasks(event, data) {
var listeners = this.callbacks[event] || [];
var pres = this._pre.slice(0).map(function(pre) {
return function(next) {
Function constructor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options, done) {
var factory = options.factory || new Factory();
this.gameSerializer = new GameSerializer(factory);
this.game = this.gameSerializer.deserialize(options.game);
Function getDataForTurn
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getDataForTurn(turn) {
var phase = 'waiting';
var playerIndex = null;
var prevTurn;
- 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 initRoad
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
initRoad: function(req, next) {
var board = this.game.board;
var ownedEdges = board.edges.query({ owner: req.player });
var distributeResources = ownedEdges.length === 1;
var data = {};
- 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 hasAllowance
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
hasAllowance: function(object) {
return function(req, next) {
var objects = [];
var yes = false;
- 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 getBuildableEdgesForPlayer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getBuildableEdgesForPlayer(player, cornerId) {
if (this.phase === 'setup') {
var corner;
if (cornerId != 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"