Showing 72 of 1,243 total issues
Method perform
has a Cognitive Complexity of 611 (exceeds 5 allowed). Consider refactoring. Open
def perform(message, bot)
@bot = bot
log("incoming message from #{message.from.first_name}: #{message.text}")
if MAINTENANCE.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
File input_processor_job.rb
has 1033 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Lycantulul
class InputProcessorJob
include SuckerPunch::Job
attr_accessor :bot
Method perform
has 473 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(message, bot)
@bot = bot
log("incoming message from #{message.from.first_name}: #{message.text}")
if MAINTENANCE.call
File game.rb
has 791 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Lycantulul
class Game
include Mongoid::Document
include Mongoid::Locker
include Mongoid::Timestamps
Method kill_victim
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
def kill_victim
self.with_lock(wait: true) do
vc = self.sort(victim)
hhost = self.homeless_host
LycantululBot.log(vc.to_s)
- 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
Class Game
has 63 methods (exceeds 20 allowed). Consider refactoring. Open
class Game
include Mongoid::Document
include Mongoid::Locker
include Mongoid::Timestamps
Method message_action
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
def message_action(game, action, aux = nil)
case action
when BROADCAST_ROLE
log('game starts')
opening = 'MULAI! MWA HA HA HA'
Class InputProcessorJob
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class InputProcessorJob
include SuckerPunch::Job
attr_accessor :bot
Method role_count
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def role_count(role, count = nil)
count ||= self.players.count
count -= Lycantulul::InputProcessorJob::MINIMUM_PLAYER.call
custom = self.custom_roles[role] rescue nil
- 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 message_action
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def message_action(game, action, aux = nil)
case action
when BROADCAST_ROLE
log('game starts')
opening = 'MULAI! MWA HA HA HA'
- 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 send
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def send(message, text, reply: nil, html: nil, keyboard: nil, async: true)
options = {
chat_id: message.chat.id,
text: text[0...4000],
}
- 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 get_stats
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_stats(stat)
stats = ["Statistik #{stat}"]
case stat
when '/stats'
stats << "Current stats:"
Method kill_victim
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def kill_victim
self.with_lock(wait: true) do
vc = self.sort(victim)
hhost = self.homeless_host
LycantululBot.log(vc.to_s)
Method raise_the_dead
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def raise_the_dead
self.with_lock(wait: true) do
ss = self.necromancee
LycantululBot.log(ss.to_s)
self.update_attribute(:necromancee, [])
- 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 check_round_finished
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def check_round_finished(game, round, force = false)
log("checking round finished #{round}")
game.reload
return unless round == game.round && game.night? && !game.waiting? && !game.discussion? && !game.finished?
log('continuing')
- 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 enlighten_seer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def enlighten_seer
self.with_lock(wait: true) do
ss = self.seen
LycantululBot.log(ss.to_s)
self.update_attribute(:seen, [])
- 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 check_win
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_win(game)
log('checking win condition')
game.reload
win = false
ending = ''
Method kill_votee
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def kill_votee
self.with_lock(wait: true) do
vc = self.sort(votee)
LycantululBot.log(vc.to_s)
self.update_attribute(:night, true)
- 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 role_count
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def role_count(role, count = nil)
count ||= self.players.count
count -= Lycantulul::InputProcessorJob::MINIMUM_PLAYER.call
custom = self.custom_roles[role] rescue nil
Method perform
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def perform(bot, options)
retry_count = 0
begin
bot.api.send_message(options)
rescue Faraday::TimeoutError => e
- 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"