koraktor/steam-condenser-ruby

View on GitHub
lib/steam-condenser/servers/packets/steam_packet_factory.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method packet_from_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.packet_from_data(raw_data)
      header = raw_data[0].ord
      data = raw_data[1..-1]

      case header
Severity: Minor
Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 1 hr to fix

    Avoid too many return statements within this method.
    Open

              return A2S_SERVERQUERY_GETCHALLENGE_Packet.new
    Severity: Major
    Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return RCON::RCONGoldSrcResponse.new(data)
      Severity: Major
      Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return S2A_PLAYER_Packet.new(data)
        Severity: Major
        Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return S2A_RULES_Packet.new(data)
          Severity: Major
          Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return A2S_RULES_Packet
            Severity: Major
            Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return S2C_CHALLENGE_Packet.new(data)
              Severity: Major
              Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return A2M_GET_SERVERS_BATCH2_Packet.new(data)
                Severity: Major
                Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return M2A_SERVER_BATCH_Packet.new(data)
                  Severity: Major
                  Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

                    Method reassemble_packet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.reassemble_packet(split_packets, is_compressed = false, packet_checksum = 0)
                          packet_data = split_packets.join ''
                    
                          if is_compressed
                            begin
                    Severity: Minor
                    Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 25 mins to fix

                    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

                    There are no issues that match your filters.

                    Category
                    Status