Showing 36 of 48 total issues
Function exports
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
// Metadata
this.name = "Mafia";
Function exports
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function() {
// Metadata
this.name = "Mafia";
- 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 init
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function(room) {
var roles = {};
var sum = 0;
var playerShift = 0;
Function init
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
init: function(room) {
var roles = {};
var sum = 0;
var playerShift = 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 getVoteAction
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
getVoteAction: function(role, stage) {
return {
isAvailable: function(player) {
return player.room.currentStage === stage && (!player.roles || !player.roles.dead);
- 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 exports
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
name: "Parieur",
Function exports
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
start: function(room, callback) {
Function exports
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
start: function(room, callback) {
// Reset pending death
Function exports
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
name: "Terroriste",
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
name: "Conseiller",
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
name: "Dentiste",
Function exports
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
name: "Docteur",
Function init
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function(gameplay) {
gameplay.resetPlayerInfo = function() {
this.room.players.forEach(function(p) {
this.sendPlayerInfo(p);
Function exports
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function() {
return {
name: "Conseiller",
- 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 getVoteAction
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
getVoteAction: function(role, stage) {
return {
isAvailable: function(player) {
return player.room.currentStage === stage && (!player.roles || !player.roles.dead);
Function exports
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
return {
name: "Secouriste",
Function start
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
start: function(room, callback) {
// Reset pending death
room.players.forEach(function(p) {
p.player.pendingDeath = [];
});
Function exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(room) {
var channels = {
mafia: {r: true, w: true, n: "Mafia", p: 10},
dead: {r: true, w: true, n: "Cimetière", p: 5},
Function start
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
start: function(room, callback) {
room.message("<div class='mafia-day-transition'><span class='glyphicon glyphicon-bell'></span> Un nouveau jour se lève...</div>");
room.gameplay.events.emit("beforeDawn");
Function beforeAll
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
beforeAll: function(room) {
room.gameplay.events.on("beforeDawn", function() {
room.players.forEach(function(p) {
if (p.player.gamblerHasPlayed && p.player.outcome)
rewardGambler(p.player);