Lesterpig/openparty-mafia

View on GitHub

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";
Severity: Major
Found in definition.js - About 6 hrs to fix

    Function exports has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function() {
    
      // Metadata
    
      this.name        = "Mafia";
    Severity: Minor
    Found in definition.js - About 4 hrs to fix

    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;
    Severity: Major
    Found in roles/index.js - About 3 hrs to fix

      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;
      Severity: Minor
      Found in roles/index.js - About 3 hrs to fix

      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);
      Severity: Minor
      Found in lib/votes.js - About 3 hrs to fix

      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",
      Severity: Major
      Found in roles/gambler.js - About 2 hrs to fix

        Function exports has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function() {
        
          return {
            start: function(room, callback) {
        
        
        Severity: Major
        Found in stages/vote.js - About 2 hrs to fix

          Function exports has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function() {
          
            return {
              start: function(room, callback) {
                // Reset pending death
          Severity: Major
          Found in stages/mafia.js - About 2 hrs to fix

            Function exports has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function() {
            
              return {
            
                name: "Terroriste",
            Severity: Minor
            Found in roles/terrorist.js - About 1 hr to fix

              Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function() {
              
                return {
              
                  name: "Conseiller",
              Severity: Minor
              Found in roles/councilman.js - About 1 hr to fix

                Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function() {
                
                  return {
                
                    name: "Dentiste",
                Severity: Minor
                Found in roles/dentist.js - About 1 hr to fix

                  Function exports has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function() {
                  
                    return {
                  
                      name: "Docteur",
                  Severity: Minor
                  Found in roles/doctor.js - About 1 hr to fix

                    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);
                    Severity: Minor
                    Found in lib/playerInfo.js - About 1 hr to fix

                      Function exports has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = function() {
                      
                        return {
                      
                          name: "Conseiller",
                      Severity: Minor
                      Found in roles/councilman.js - About 1 hr to fix

                      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);
                      Severity: Minor
                      Found in lib/votes.js - About 1 hr to fix

                        Function exports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function() {
                        
                          return {
                        
                            name: "Secouriste",
                        Severity: Minor
                        Found in roles/rescuer.js - About 1 hr to fix

                          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 = [];
                                });
                          Severity: Minor
                          Found in stages/mafia.js - About 1 hr to fix

                            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},
                            Severity: Minor
                            Found in roles/gamemaster.js - About 1 hr to fix

                              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");
                              Severity: Minor
                              Found in stages/vote.js - About 1 hr to fix

                                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);
                                Severity: Minor
                                Found in roles/gambler.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language