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
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
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)
Avoid deeply nested control flow statements. Open
return unless message.from.username == 'araishikeiwai'
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
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
Method perform
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def perform(game, round, state, time, ip)
Method remind
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def remind(game, round, time, next_reminder, state)
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
- 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
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
- 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
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
- 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
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)
- 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"