Method check_subscribed_teams!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_subscribed_teams!
Team.where(subscribed: true, :stripe_customer_id.ne => nil).each do |team|
if team.subscribed? && team.stripe_customer.subscriptions.none?
logger.info "No active subscriptions for #{team} (#{team.stripe_customer_id}), downgrading."
team.inform_admin! 'Your subscription was canceled and your team has been downgraded. Thank you for being a customer!'
- 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 deactivate_dead_teams!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def deactivate_dead_teams!
Team.active.each do |team|
next if team.subscribed?
next unless team.dead?
- 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 check_trials!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_trials!
Team.active.where(subscribed: false).each do |team|
logger.info "Team #{team} has #{team.remaining_trial_days} trial days left."
next unless team.remaining_trial_days > 0 && team.remaining_trial_days <= 3
- 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 check_active_subscriptions_without_teams!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_active_subscriptions_without_teams!
Stripe::Subscription.all(plan: 'slack-playplay-yearly').each do |subscription|
next if subscription.cancel_at_period_end
next if Team.where(stripe_customer_id: subscription.customer).exists?
- 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"