koraktor/steam-condenser-ruby

View on GitHub

Showing 39 of 39 total issues

Class SteamId has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

  class SteamId

    include Cacheable
    cacheable_with_ids :custom_url, :steam_id64

Severity: Minor
Found in lib/steam-condenser/community/steam_id.rb - About 3 hrs to fix

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

        def fetch
          profile = parse "#{base_url}?xml=1"
    
          raise SteamCondenser::Error, profile['error'] unless profile['error'].nil?
    
    
    Severity: Minor
    Found in lib/steam-condenser/community/steam_id.rb - About 2 hrs 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 reply has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def reply
          receive_packet 1400
          is_compressed = false
          packet_checksum = 0
    
    
    Severity: Minor
    Found in lib/steam-condenser/servers/sockets/source_socket.rb - About 1 hr 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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.get(format, interface, method, version = 1, params = {})
          params = { key: WebApi.api_key }.merge params unless WebApi.api_key.nil?
          params = { format: format }.merge params
          protocol = @@secure ? 'https' : 'http'
          url = "#{protocol}://api.steampowered.com/#{interface}/#{method}/v#{version}/" +
    Severity: Minor
    Found in lib/steam-condenser/community/web_api.rb - About 1 hr 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 handle_response_for_request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def handle_response_for_request(request_type, repeat_on_failure = true)
            case request_type
              when :challenge then
                request_packet = Packets::A2S_PLAYER_Packet.new
                expected_response = Packets::S2C_CHALLENGE_Packet
    Severity: Minor
    Found in lib/steam-condenser/servers/game_server.rb - About 1 hr 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 servers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def servers(region_code = MasterServer::REGION_ALL, filters = '', force = false)
            finished       = false
            current_server = '0.0.0.0:0'
            server_array   = []
    
    
    Severity: Minor
    Found in lib/steam-condenser/servers/master_server.rb - About 1 hr 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 reply has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def reply
          receive_packet 1400
          is_compressed = false
          packet_checksum = 0
    
    
    Severity: Minor
    Found in lib/steam-condenser/servers/sockets/source_socket.rb - About 1 hr to fix

      Method handle_response_for_request has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def handle_response_for_request(request_type, repeat_on_failure = true)
              case request_type
                when :challenge then
                  request_packet = Packets::A2S_PLAYER_Packet.new
                  expected_response = Packets::S2C_CHALLENGE_Packet
      Severity: Minor
      Found in lib/steam-condenser/servers/game_server.rb - About 1 hr to fix

        Method initialize has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize(data)
              super S2A_INFO2_HEADER, data
        
              info.merge!({
                protocol_version: @content_data.getbyte,
        Severity: Minor
        Found in lib/steam-condenser/servers/packets/s2a_info2_packet.rb - About 1 hr to fix

          Method initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def initialize(data)
                super S2A_INFO_DETAILED_HEADER, data
          
                info.merge!({
                  game_ip: @content_data.cstring,
          Severity: Minor
          Found in lib/steam-condenser/servers/packets/s2a_info_detailed_packet.rb - About 1 hr to fix

            Method fetch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def fetch
                  data = WebApi.json! "IEconItems_#{app_id}", 'GetSchema', 1, language: language
            
                  @attributes = {}
                  data[:attributes].each do |attribute|
            Severity: Minor
            Found in lib/steam-condenser/community/game_item_schema.rb - About 1 hr to fix

              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

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

                    def initialize(data)
                      super S2A_INFO2_HEADER, data
                
                      info.merge!({
                        protocol_version: @content_data.getbyte,
                Severity: Minor
                Found in lib/steam-condenser/servers/packets/s2a_info2_packet.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
                Open

                      def new(*args)
                        arity = self.instance_method(:initialize).arity.abs
                        args += Array.new(arity - args.size) if args.size < arity
                        bypass_cache = args.size > arity + 1 ? args.pop : false
                        fetch = args.size > arity ? args.pop : true
                Severity: Minor
                Found in lib/steam-condenser/community/cacheable.rb - About 1 hr 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 servers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def servers(region_code = MasterServer::REGION_ALL, filters = '', force = false)
                        finished       = false
                        current_server = '0.0.0.0:0'
                        server_array   = []
                
                
                Severity: Minor
                Found in lib/steam-condenser/servers/master_server.rb - About 1 hr to fix

                  Method initialize has 28 lines of code (exceeds 25 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 1 hr to fix

                    Method fetch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def fetch
                          profile = parse "#{base_url}?xml=1"
                    
                          raise SteamCondenser::Error, profile['error'] unless profile['error'].nil?
                    
                    
                    Severity: Minor
                    Found in lib/steam-condenser/community/steam_id.rb - About 1 hr to fix

                      Method reply has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def reply
                            receive_packet 1400
                      
                            if @buffer.long == 0xFFFFFFFE
                              split_packets = []
                      Severity: Minor
                      Found in lib/steam-condenser/servers/sockets/goldsrc_socket.rb - About 1 hr to fix

                        Method reply has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def reply
                              receive_packet 1400
                        
                              if @buffer.long == 0xFFFFFFFE
                                split_packets = []
                        Severity: Minor
                        Found in lib/steam-condenser/servers/sockets/goldsrc_socket.rb - About 55 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 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def rcon_exec(password, command)
                              rcon_challenge if @rcon_challenge.nil? || @is_hltv
                        
                              rcon_send "rcon #@rcon_challenge #{password} #{command}"
                              if @is_hltv
                        Severity: Minor
                        Found in lib/steam-condenser/servers/sockets/goldsrc_socket.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

                        Severity
                        Category
                        Status
                        Source
                        Language