nabeelamjad/poke-api

View on GitHub

Showing 13 of 71 total issues

File pogoprotos_networking_responses.rb has 659 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'google/protobuf'

require_relative 'pogoprotos_data'
require_relative 'pogoprotos_inventory'
require_relative 'pogoprotos_data_capture'
Severity: Major
Found in lib/poke-api/pogoprotos/pogoprotos_networking_responses.rb - About 1 day to fix

    File pogoprotos_enums.rb has 634 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'google/protobuf'
    
    Google::Protobuf::DescriptorPool.generated_pool.build do
      add_enum "POGOProtos.Enums.TutorialState" do
        value :LEGAL_SCREEN, 0
    Severity: Major
    Found in lib/poke-api/pogoprotos/pogoprotos_enums.rb - About 1 day to fix

      File pogoprotos_networking_requests_messages.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'google/protobuf'
      
      require_relative 'pogoprotos_enums'
      require_relative 'pogoprotos_inventory_item'
      require_relative 'pogoprotos_data_player'
      Severity: Minor
      Found in lib/poke-api/pogoprotos/pogoprotos_networking_requests_messages.rb - About 2 hrs to fix

        Method find_poi has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def find_poi(client, lat, lng)
          step_size = 0.0015
          step_limit = 49
        
          coords = generate_spiral(lat, lng, step_size, step_limit)
        Severity: Minor
        Found in examples/spiral_search.rb - About 1 hr to fix

          Method parse_rpc_fields has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                def parse_rpc_fields(responses)
                  responses.map! do |x|
                    x = x.to_hash if x.class.name =~ /POGOProtos/
                    x
                  end if responses.is_a?(Array)
          Severity: Minor
          Found in lib/poke-api/response.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 level has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  def level
                    return MAX_LEVEL if leaf?
          
                    x = (@id & 0xffffffff)
                    level = -1
          Severity: Minor
          Found in lib/poke-api/geometry/s2_cell_id.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 generate_spiral has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def generate_spiral(starting_lat, starting_lng, step_size, step_limit)
            coords = [{ lat: starting_lat, lng: starting_lng }]
            steps = 1
            x = 0
            y = 0
          Severity: Minor
          Found in examples/spiral_search.rb - About 1 hr to fix

            Method lookup_cells has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def self.lookup_cells(level, i, j, orig_orientation, pos, orientation)
            Severity: Minor
            Found in lib/poke-api/geometry/s2_base.rb - About 45 mins to fix

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

              def find_poi(client, lat, lng)
                step_size = 0.0015
                step_limit = 49
              
                coords = generate_spiral(lat, lng, step_size, step_limit)
              Severity: Minor
              Found in examples/spiral_search.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 lookup_bits has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def self.lookup_bits(i, j, orig_orientation, pos, orientation)
              Severity: Minor
              Found in lib/poke-api/geometry/s2_base.rb - About 35 mins to fix

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

                def generate_spiral(starting_lat, starting_lng, step_size, step_limit)
                  coords = [{ lat: starting_lat, lng: starting_lng }]
                  steps = 1
                  x = 0
                  y = 0
                Severity: Minor
                Found in examples/spiral_search.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 largest_abs_component has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def largest_abs_component
                          temp = abs
                
                          if temp[0] > temp[1]
                            temp[0] > temp[2] ? 0 : 2
                Severity: Minor
                Found in lib/poke-api/geometry/s2_point.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 add_optional_signature_information has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.add_optional_signature_information(sig, api_client)
                        %i(android_gps_info sensor_info device_info activity_status location_fix).each do |i|
                          name = Helpers.camel_case_lower(i)
                
                          if api_client.send(i)
                Severity: Minor
                Found in lib/poke-api/signature.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