Showing 39 of 41 total issues
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
Class Reservation
has 57 methods (exceeds 20 allowed). Consider refactoring. Open
class Reservation < ActiveRecord::Base
belongs_to :user
belongs_to :server
belongs_to :server_config, optional: true
belongs_to :whitelist, optional: true
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 right
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.right
%w[
alba
admirable
adysky
Method sort_bucket_objects
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def sort_bucket_objects(objects, statistics, sort_by)
sort_by_attribute = friendly_sort_name_to_attribute(sort_by)
sort_by_object = if %i[map_name size].include?(sort_by_attribute)
:self
else
- 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 league_configs
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.league_configs
%w[
etf2l
etf2l_6v6
etf2l_6v6_5cp
Class ReservationsController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ReservationsController < ApplicationController
before_action :require_admin, only: %i[streaming]
skip_before_action :redirect_if_country_banned, only: :played_in
skip_before_action :authenticate_user!, only: %i[motd]
skip_before_action :store_current_location, only: %i[extend_reservation destroy]
Class User
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
devise :omniauthable, :rememberable, :trackable
has_many :reservations
has_many :log_uploads, through: :reservations
Method commands_to_suggest
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.commands_to_suggest
[
{ command: 'ban', description: 'Ban a player' },
{ command: 'banid', description: 'Ban a player by ID' },
{ command: 'banip', description: 'Ban an IP address' },
Class LogWorker
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class LogWorker
include Sidekiq::Worker
sidekiq_options retry: 1
attr_accessor :raw_line, :line, :message
File rcon_autocomplete.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
class RconAutocomplete
attr_accessor :query, :reservation
def initialize(reservation = nil)
@reservation = reservation
Method status
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def status
Rails.cache.fetch "server_info_#{server.id}", expires_in: 1.minute do
out = {}
fetch_rcon_status.lines.each do |line|
case line
- 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_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 sort_bucket_objects
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sort_bucket_objects(objects, statistics, sort_by)
sort_by_attribute = friendly_sort_name_to_attribute(sort_by)
sort_by_object = if %i[map_name size].include?(sort_by_attribute)
:self
else
Method status
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def status
return 'Ended' if past?
status_messages = reservation_statuses.pluck(:status)
return 'Ended' if status_messages.include?('Finished zipping logs and demos')
- 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 copy_from_server
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def copy_from_server(files, destination)
return if files.none?
logger.debug "FTP GET, FILES: #{files} DESTINATION: #{destination}"
threads = []
- 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_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 show
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def show
reservation_id = params[:id]&.split('-')&.[](1)&.to_i
respond_to do |format|
format.zip do
reservation = find_reservation(reservation_id)
- 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 update_reservation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_reservation
respond_to do |format|
format.html do
if reservation.update(reservation_params)
if reservation.now?
- 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 initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, steam_id, connect_duration, ping, loss, state, ip)