integrallis/stripe_saas

View on GitHub

Showing 7 of 7 total issues

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

    def processing!
      # if their package level has changed ..
      if changing_plans?
        # and a customer exists in stripe ..
        if stripe_id.present?
Severity: Minor
Found in app/concerns/stripe_saas/subscription.rb - About 4 hrs 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 load_owner has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def load_owner
      unless params[:owner_id].nil?
        if current_owner.present?

          # we need to try and look this owner up via the find method so that we're
Severity: Minor
Found in app/controllers/stripe_saas/subscriptions_controller.rb - About 2 hrs 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 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def processing!
      # if their package level has changed ..
      if changing_plans?
        # and a customer exists in stripe ..
        if stripe_id.present?
Severity: Major
Found in app/concerns/stripe_saas/subscription.rb - About 2 hrs to fix

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

        def new
          if no_owner?
    
            if defined?(Devise)
    
    
    Severity: Minor
    Found in app/controllers/stripe_saas/subscriptions_controller.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 redirect_to_sign_up has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def redirect_to_sign_up
          # this is a Devise default variable and thus should not change its name
          # when we change subscription owners from :user to :company
          begin
            plan = ::Plan.find(params[:plan])
    Severity: Minor
    Found in app/controllers/stripe_saas/subscriptions_controller.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 to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def to_s
        case feature.feature_type.to_sym
          when :boolean
            "#{self.value ? '' : 'No '}#{self.feature.name}"
          when :number, :percentage, :filesize, :interval
    Severity: Minor
    Found in app/concerns/stripe_saas/plan_feature.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 find_customer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.find_customer(subscription_or_owner)
        if subscription_or_owner.class.to_s.downcase.to_sym == StripeSaas.subscriptions_owned_by
          owner = subscription_or_owner
        else
          owner = subscription_or_owner.send StripeSaas.subscriptions_owned_by
    Severity: Minor
    Found in app/concerns/stripe_saas/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

    Severity
    Category
    Status
    Source
    Language