adelevie/parse-ruby-client

View on GitHub
lib/parse/object.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

    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 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 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

    There are no issues that match your filters.

    Category
    Status