Class Server
has 80 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < ActiveRecord::Base
include ApplicationHelper
has_many :group_servers
has_many :groups, through: :group_servers
File server.rb
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Server < ActiveRecord::Base
include ApplicationHelper
has_many :group_servers
has_many :groups, through: :group_servers
Method start_reservation
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_reservation(reservation)
reservation.enable_mitigations if supports_mitigations?
update_configuration(reservation)
if reservation.enable_plugins? || reservation.enable_demos_tf? || au_system?
Method start_reservation
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def start_reservation(reservation)
reservation.enable_mitigations if supports_mitigations?
update_configuration(reservation)
if reservation.enable_plugins? || reservation.enable_demos_tf? || au_system?
- 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 save_version_info
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save_version_info(server_info)
return unless server_info&.version.present?
if server_info.version < self.class.latest_version
Rails.logger.warn("Server #{name} was updating since #{I18n.l(update_started_at, format: :short)} but is now back online with old version #{server_info.version} instead of latest #{self.class.latest_version}") if update_status == 'Updating'
- 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 rcon_exec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rcon_exec(command, allow_blocked: false)
return nil if blocked_command?(command) && !allow_blocked
condenser.rcon_exec(command) if rcon_auth
rescue Errno::ECONNREFUSED, SteamCondenser::Error::Timeout, SteamCondenser::Error::RCONNoAuth, SteamCondenser::Error::RCONBan => 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"