adelevie/parse-ruby-client

View on GitHub

Showing 19 of 19 total issues

Class Object has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Object < Hash
    attr_reader :parse_object_id
    attr_reader :class_name
    attr_reader :created_at
    attr_reader :updated_at
Severity: Minor
Found in lib/parse/object.rb - About 3 hrs to fix

    Class Query has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Query
        attr_accessor :where
        attr_accessor :class_name
        attr_accessor :order_by
        attr_accessor :order
    Severity: Minor
    Found in lib/parse/query.rb - About 2 hrs to fix

      File datatypes.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'time'
      require 'date'
      require 'base64'
      
      module Parse
      Severity: Minor
      Found in lib/parse/datatypes.rb - About 2 hrs to fix

        Method array_op has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def array_op(field, operation, value)
              error_msg = "field #{field} not an array"
              raise error_msg if self[field] && !self[field].is_a?(Array)
        
              if @parse_object_id
        Severity: Minor
        Found in lib/parse/object.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 save has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def save
              body = { data: @data }
        
              if @type
                if @where
        Severity: Minor
        Found in lib/parse/push.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 initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize(data = {}, &_blk)
              @host           = data[:host]
              @path           = data[:path] || Protocol::PATH
        
              @application_id = data[:application_id]
        Severity: Minor
        Found in lib/parse/client.rb - About 1 hr to fix

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

              def get
                uri = if @class_name == Parse::Protocol::CLASS_USER
                        Protocol.user_uri
                      elsif @class_name == Parse::Protocol::CLASS_INSTALLATION
                        Protocol.installation_uri
          Severity: Minor
          Found in lib/parse/query.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 process_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_response(env)
                env[:raw_body] = env[:body] if preserve_raw?(env)
          
                if env[:status] >= 400
                  begin
          Severity: Minor
          Found in lib/faraday/extended_parse_json.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(data = {}, &_blk)
                @host           = data[:host]
                @path           = data[:path] || Protocol::PATH
          
                @application_id = data[:application_id]
          Severity: Minor
          Found in lib/parse/client.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 parse_json has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.parse_json(class_name, obj)
              if obj.nil?
                nil
          
              # Array
          Severity: Minor
          Found in lib/parse/util.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get
                uri = if @class_name == Parse::Protocol::CLASS_USER
                        Protocol.user_uri
                      elsif @class_name == Parse::Protocol::CLASS_INSTALLATION
                        Protocol.installation_uri
          Severity: Minor
          Found in lib/parse/query.rb - About 1 hr to fix

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

                def process_response(env)
                  env[:raw_body] = env[:body] if preserve_raw?(env)
            
                  if env[:status] >= 400
                    begin
            Severity: Minor
            Found in lib/faraday/extended_parse_json.rb - About 1 hr to fix

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

                  def parse(data)
                    return unless data
              
                    @parse_object_id ||= data[Protocol::KEY_OBJECT_ID]
              
              
              Severity: Minor
              Found in lib/parse/object.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 copy_client has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.copy_client(client, parsed_data)
                  do_copy = lambda do |object|
                    if object.is_a?(Parse::Object)
                      object.client = client
                      object.each do |_key, value|
              Severity: Minor
              Found in lib/parse/util.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 request has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def request(uri, method = :get, body = nil, query = nil, content_type = nil)
              Severity: Minor
              Found in lib/parse/client.rb - About 35 mins to fix

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

                  def self.object_pointer_equality?(a, b)
                    classes = [Parse::Object, Parse::Pointer]
                    return false unless classes.any? { |c| a.is_a?(c) } && classes.any? { |c| b.is_a?(c) }
                    return true if a.equal?(b)
                    return false if a.new? || b.new?
                Severity: Minor
                Found in lib/parse/util.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize(data, client = nil)
                      # convert hash keys to strings
                      data = Hash[data.map { |k, v| [k.to_s, v] }]
                
                      @local_filename = data['local_filename'] if data['local_filename']
                Severity: Minor
                Found in lib/parse/datatypes.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 pointerize_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.pointerize_value(obj)
                    if obj.is_a?(Parse::Object)
                      p = obj.pointer
                      raise ArgumentError, "new object used in context requiring pointer #{obj}" unless p
                      p
                Severity: Minor
                Found in lib/parse/util.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 safe_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def safe_hash
                      Hash[map do |key, value|
                        if Protocol::RESERVED_KEYS.include?(key)
                          nil
                        elsif value.is_a?(Hash) &&
                Severity: Minor
                Found in lib/parse/object.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