Lesterpig/openparty-mafia

View on GitHub

Showing 36 of 48 total issues

Function sendPlayerInfo has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    gameplay.sendPlayerInfo = function(p) {
      if(!p.player) {
        return;
      }

Severity: Minor
Found in lib/playerInfo.js - About 1 hr to fix

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

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

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

      module.exports = function() {
      
        return {
      
          name: "Terroriste",
      Severity: Minor
      Found in roles/terrorist.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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function() {
      
        return {
          start: function(room, callback) {
      
      
      Severity: Minor
      Found in stages/vote.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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function() {
      
        return {
      
          name: "Parieur",
      Severity: Minor
      Found in roles/gambler.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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function() {
      
        return {
          start: function(room, callback) {
            // Reset pending death
      Severity: Minor
      Found in stages/mafia.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 exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function execute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              execute: function(player, choice) {
        
                var sendPlayerInfo = player.room.gameplay.sendPlayerInfo.bind(player.room.gameplay);
        
                if(choice === "(Personne)") {
        Severity: Minor
        Found in lib/votes.js - About 1 hr to fix

          Function isValidTarget has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          var isValidTarget = function(playerSource, playerTarget, targets) {
            return !((playerTarget.roles.gamemaster)
                 || (!targets.self && playerSource == playerTarget)
                 || ((targets.innocent === "yes" && (playerTarget.roles.mafia || playerTarget.roles.godfather)) || (!targets.innocent && (!playerTarget.roles.mafia && !playerTarget.roles.godfather)))
                 || ((targets.alive === "yes" && playerTarget.roles.dead) || (!targets.alive && !playerTarget.roles.dead)));
          Severity: Minor
          Found in lib/actions.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 exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

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

            module.exports = function() {
            
              return {
            
                name: "Docteur",
            Severity: Minor
            Found in roles/doctor.js - About 55 mins 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              init: function(gameplay) {
            
                gameplay.endGame = function(msg) {
                  this.room.nextStage("end", function() {
                    this.room.message("<h2>" + msg + "</h2>");
            Severity: Minor
            Found in lib/victory.js - About 45 mins 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function() {
            
              return {
            
                name: "Dentiste",
            Severity: Minor
            Found in roles/dentist.js - About 45 mins 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

            Avoid too many return statements within this function.
            Open

                  return false;
            Severity: Major
            Found in lib/victory.js - About 30 mins to fix

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

              module.exports = function() {
              
                return {
              
                  name: "Détective",
              Severity: Minor
              Found in roles/detective.js - About 25 mins 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 fn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  fn: function(player, args) {
                    var sound = {id : args[0], path : args[0]};
              
                    var arg1 = +args[1];
                    var arg2 = +args[2];
              Severity: Minor
              Found in lib/commands.js - About 25 mins 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

              Severity
              Category
              Status
              Source
              Language