tulul/lycantulul_bot

View on GitHub

Showing 72 of 1,243 total issues

Avoid deeply nested control flow statements.
Open

                  if vh || wh
                    dh = self.players.with_id(hh[:homeless_id])
                    dh.kill
                    self.temp_stats[dh.user_id] ||= []
                    self.temp_stats[dh.user_id] << 'homeless_mauled' if vh
Severity: Major
Found in lib/lycantulul_bot/lycantulul/game.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if in_group?(message)
                  if game = check_game(message)
                    if game.waiting?
                      if game.pending_custom_id
                        game.cancel_pending_custom
    Severity: Major
    Found in lib/lycantulul_bot/lycantulul/input_processor_job.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if in_group?(message)
                    if game = check_game(message)
                      unless game.waiting?
                        unless game.night?
                          summon(game, :voting)
      Severity: Major
      Found in lib/lycantulul_bot/lycantulul/input_processor_job.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    return unless message.from.username == 'araishikeiwai'
        Severity: Major
        Found in lib/lycantulul_bot/lycantulul/input_processor_job.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if in_group?(message)
                        if game = check_game(message)
                          if (Time.now - game.last_player_list_query rescue 11).ceil > 10
                            list_players(game)
                          end
          Severity: Major
          Found in lib/lycantulul_bot/lycantulul/input_processor_job.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if in_group?(message)
                          if game = check_game(message)
                            if game.waiting?
                              if game.custom_roles
                                game.remove_custom_roles
            Severity: Major
            Found in lib/lycantulul_bot/lycantulul/input_processor_job.rb - About 45 mins to fix

              Method perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def perform(game, round, state, time, ip)
              Severity: Minor
              Found in lib/lycantulul_bot/lycantulul/voting_timer_job.rb - About 35 mins to fix

                Method remind has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def remind(game, round, time, next_reminder, state)
                Severity: Minor
                Found in lib/lycantulul_bot/lycantulul/input_processor_job.rb - About 35 mins to fix

                  Method role_setting_keyboard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def role_setting_keyboard
                        keyboard = []
                        max = IMPORTANT_ROLES.count
                        sorted_roles = IMPORTANT_ROLES.sort_by{ |role| self.get_role(self.class.const_get(role.upcase)) }
                        count = -1
                  Severity: Minor
                  Found in lib/lycantulul_bot/lycantulul/game.rb - About 35 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

                  Method roles_statistics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def roles_statistics
                        sum = self.game
                        tot = {}
                        Lycantulul::Game::ROLES.each do |role|
                          tot[role] ||= 0
                  Severity: Minor
                  Found in lib/lycantulul_bot/lycantulul/registered_player.rb - About 35 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

                  Method start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def start
                        self.with_lock(wait: true) do
                          return unless self.waiting?
                          self.waiting = false
                          self.voting_time ||= Lycantulul::InputProcessorJob::VOTING_TIME.call
                  Severity: Minor
                  Found in lib/lycantulul_bot/lycantulul/game.rb - 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

                  Method set_custom_role has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def set_custom_role(amount)
                        self.with_lock(wait: true) do
                          return nil unless self.pending_custom_role
                          return nil unless amount.in?(0..100)
                          self.update_custom_roles(self.pending_custom_role, amount)
                  Severity: Minor
                  Found in lib/lycantulul_bot/lycantulul/game.rb - 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