Showing 51 of 126 total issues
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(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 animate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
DieModel.prototype.animate = function(sequence) {
var numNumbers = sequence.length;
var state = 'die';
if (numNumbers % 2 === 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 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"
Further reading
Avoid too many return
statements within this function. Open
return this.players.find(player => player.id === userId);
Function render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render(options, tileset) {
var tileStyle = tileset.tiles[options.type];
var tileSpacing = tileset.board.tilespacing || 8;
var hexagonOpts = this.getHexOptions(
tileStyle,
- 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 onTurnStart
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
UserInterface.prototype.onTurnStart = function() {
if (!this.viewModel.myTurn) {
return;
}
- 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 register
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.register = function(server, options, next) {
server.route({
method: 'GET',
path: '/logout',
config: {
- 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 defineObservableProperty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function defineObservableProperty(obj, propertyName, value) {
var isComputed = typeof value === 'function';
var isArray = Array.isArray(value);
var observable;
- 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 defineObservableProperties
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function defineObservableProperties(obj, properties) {
obj._observables = obj._observables || {};
if (!obj.getObservable) {
obj.getObservable = function getObservable(observableName) {
- 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"