koraktor/steam-condenser-ruby

View on GitHub

Showing 37 of 39 total issues

Method add_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def add_info(player_data)
      unless player_data[:name] == @name
        raise Error, 'Information to add belongs to a different player.'
      end

Severity: Minor
Found in lib/steam-condenser/servers/steam_player.rb - About 45 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

Method get has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.get(format, interface, method, version = 1, params = {})
Severity: Minor
Found in lib/steam-condenser/community/web_api.rb - About 35 mins to fix

    Method initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(inventory, item_data)
          @inventory = inventory
    
          @defindex          = item_data[:defindex]
          @backpack_position = item_data[:inventory] & 0xffff
    Severity: Minor
    Found in lib/steam-condenser/community/game_item.rb - About 35 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

    Method update_players has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def update_players(rcon_password = nil)
            handle_response_for_request :players
    
            unless @rcon_authenticated
              return if rcon_password.nil?
    Severity: Minor
    Found in lib/steam-condenser/servers/game_server.rb - About 35 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

    Method new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.new(app_id, steam_id = nil, *args)
          args = args.unshift steam_id unless steam_id.nil?
          if self == GameInventory
            raise ArgumentError, 'wrong number of arguments (1 for 2)' if args.empty?
          else
    Severity: Minor
    Found in lib/steam-condenser/community/game_inventory.rb - About 35 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

    Method rcon_exec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def rcon_exec(command)
            raise Error::RCONNoAuth unless @rcon_authenticated
    
            @rcon_socket.send_packet Packets::RCON::RCONExecRequest.new(@rcon_request_id, command)
    
    
    Severity: Minor
    Found in lib/steam-condenser/servers/source_server.rb - About 35 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

    Method fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch
          result = WebApi.json! "IEconItems_#@app_id", 'GetPlayerItems', 1, SteamID: @user.steam_id64
          item_class = self.class.instance_variable_get :@item_class
    
          @items = []
    Severity: Minor
    Found in lib/steam-condenser/community/game_inventory.rb - About 35 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

    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 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 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 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 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 M2A_SERVER_BATCH_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 RCON::RCONGoldSrcResponse.new(data)
                  Severity: Major
                  Found in lib/steam-condenser/servers/packets/steam_packet_factory.rb - About 30 mins to fix

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

                          def to_s
                            return_string = ''
                    
                            return_string << "Ping: #@ping\n"
                            return_string << "Challenge number: #@challenge_number\n"
                    Severity: Minor
                    Found in lib/steam-condenser/servers/game_server.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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language