andrewculver/koudoku

View on GitHub
app/concerns/koudoku/subscription.rb

Summary

Maintainability
C
1 day
Test Coverage

Method processing! has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    def processing!

      # if their package level has changed ..
      if changing_plans?

Severity: Minor
Found in app/concerns/koudoku/subscription.rb - About 1 day 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 processing! has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def processing!

      # if their package level has changed ..
      if changing_plans?

Severity: Major
Found in app/concerns/koudoku/subscription.rb - About 2 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                    if coupon.present? and coupon.free_trial?
                      customer_attributes[:trial_end] = coupon.free_trial_ends.to_i
                    end
    Severity: Major
    Found in app/concerns/koudoku/subscription.rb - About 45 mins to fix

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

        def describe_difference(plan_to_describe)
          if plan.nil?
            if persisted?
              I18n.t('koudoku.plan_difference.upgrade')
            else
      Severity: Minor
      Found in app/concerns/koudoku/subscription.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

      There are no issues that match your filters.

      Category
      Status