Showing 51 of 126 total issues
Function getTileLayout
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
getTileLayout(layout) {
var circumradius = hexInfo.circumradius;
var apothem = hexInfo.apothem;
var tiles = layout.tiles.map(row => row.split(','));
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 UserInterface
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UserInterface(options) {
this.emit = this.emit.bind(this);
this.onBoardClick = this.onBoardClick.bind(this);
this.onBuildSettlement = this.onBuildSettlement.bind(this);
this.onBuildCity = this.onBuildCity.bind(this);
Function start
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
RoomSchema.methods.start = function(callback) {
if (this.status !== 'open') {
return;
}
Function getBuildableEdgesForPlayer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBuildableEdgesForPlayer(player, cornerId) {
if (this.phase === 'setup') {
var corner;
if (cornerId != null) {
Function show
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
Function defineObservableProperties
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function defineObservableProperties(obj, properties) {
obj._observables = obj._observables || {};
if (!obj.getObservable) {
obj.getObservable = function getObservable(observableName) {
Function handler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
handler: function(request, reply) {
var Room = mongoose.model('Room');
Room.findById(request.params.roomId, function(err, room) {
if (err) {
Function buildCity
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildCity(player) {
super.buildCity(player);
if (this.drawing) {
this.drawing.destroy();
Function hasAllowance
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
hasAllowance(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 onWiiuInput
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
StageNavigator.prototype.onWiiuInput = function() {
var state = window.wiiu.gamepad.update();
var dragX = 0;
var dragY = 0;
var rotate = 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 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 buildSettlement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildSettlement(player) {
super.buildSettlement(player);
if (this.drawing) {
this.drawing.destroy();
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 onStageTransform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
onStageTransform(transform) {
var offset;
if (this.transforming) {
return;
Function next
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
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 distributeResources
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
distributeResources(req, diceTotal, next) {
var data = {};
var tiles = this.game.board.tiles.query({ value: diceTotal });
this.game.players.forEach(function(player) {