coding-chimp/onesignal

View on GitHub
lib/onesignal/models/platform_delivery_data.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method _deserialize has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _deserialize(type, value)
      case type.to_sym
      when :Time
        Time.parse(value)
      when :Date
Severity: Minor
Found in lib/onesignal/models/platform_delivery_data.rb - About 1 hr to fix

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

        def initialize(attributes = {})
          if (!attributes.is_a?(Hash))
            fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::PlatformDeliveryData` initialize method"
          end
    
    
    Severity: Minor
    Found in lib/onesignal/models/platform_delivery_data.rb - About 1 hr to fix

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

          def initialize(attributes = {})
            if (!attributes.is_a?(Hash))
              fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::PlatformDeliveryData` initialize method"
            end
      
      
      Severity: Minor
      Found in lib/onesignal/models/platform_delivery_data.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 _deserialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _deserialize(type, value)
            case type.to_sym
            when :Time
              Time.parse(value)
            when :Date
      Severity: Minor
      Found in lib/onesignal/models/platform_delivery_data.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 build_from_hash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def build_from_hash(attributes)
            return nil unless attributes.is_a?(Hash)
            attributes = attributes.transform_keys(&:to_sym)
            self.class.openapi_types.each_pair do |key, type|
              if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      Severity: Minor
      Found in lib/onesignal/models/platform_delivery_data.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 to_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_hash
            hash = {}
            self.class.attribute_map.each_pair do |attr, param|
              value = self.send(attr)
              if value.nil?
      Severity: Minor
      Found in lib/onesignal/models/platform_delivery_data.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 _to_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _to_hash(value)
            if value.is_a?(Array)
              value.compact.map { |v| _to_hash(v) }
            elsif value.is_a?(Hash)
              {}.tap do |hash|
      Severity: Minor
      Found in lib/onesignal/models/platform_delivery_data.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