fiedl/your_platform

View on GitHub
app/models/profile_fields/address.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class Address has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Address < ProfileField
    def self.model_name; ProfileField.model_name; end

    def as_json(*args)
      super.merge({
Severity: Minor
Found in app/models/profile_fields/address.rb - About 4 hrs to fix

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

          def geo_information( key )
            return nil if self.value == "—"
            return geo_location.send(key).strip if self.value.present? && geo_location.send(key).kind_of?(String) && geo_location.send(key).strip.present?
            return geo_location.send(key) if self.value.present? && geo_location.send(key).present?
          end
    Severity: Minor
    Found in app/models/profile_fields/address.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 postal_address= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def postal_address=(new_postal_address)
            if new_postal_address != self.postal_address
              if new_postal_address
                self.clear_postal_address
                self.add_flag :postal_address
    Severity: Minor
    Found in app/models/profile_fields/address.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