lib/steam-condenser/servers/packets/steam_packet_factory.rb
Method packet_from_data
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.packet_from_data(raw_data)
header = raw_data[0].ord
data = raw_data[1..-1]
case header
Avoid too many return
statements within this method. Open
Open
return A2S_SERVERQUERY_GETCHALLENGE_Packet.new
Avoid too many return
statements within this method. Open
Open
return RCON::RCONGoldSrcResponse.new(data)
Avoid too many return
statements within this method. Open
Open
return S2A_PLAYER_Packet.new(data)
Avoid too many return
statements within this method. Open
Open
return S2A_RULES_Packet.new(data)
Avoid too many return
statements within this method. Open
Open
return A2S_RULES_Packet
Avoid too many return
statements within this method. Open
Open
return S2C_CHALLENGE_Packet.new(data)
Avoid too many return
statements within this method. Open
Open
return A2M_GET_SERVERS_BATCH2_Packet.new(data)
Avoid too many return
statements within this method. Open
Open
return M2A_SERVER_BATCH_Packet.new(data)
Method reassemble_packet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.reassemble_packet(split_packets, is_compressed = false, packet_checksum = 0)
packet_data = split_packets.join ''
if is_compressed
begin
- 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"