Showing 7 of 7 total issues
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?
- Read upRead up
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?
Method load_owner
has a Cognitive Complexity of 14 (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
- Read upRead up
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 new
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def new
if no_owner?
if defined?(Devise)
- Read upRead up
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
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
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
- Read upRead up
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_subscription
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_subscription
ownership_attribute = :"#{Koudoku.subscriptions_owned_by}_id"
@subscription = ::Subscription.where(ownership_attribute => current_owner.id).find_by_id(params[:id])
# also, if cancan methods are available, we should use that to authorize.
- Read upRead up
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"