Showing 700 of 1,230 total issues
Method community_ready_for_payments?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def community_ready_for_payments?(community_id)
account_prepared_for_community?(community_id) &&
Maybe(TransactionService::API::Api.settings.get_active_by_gateway(community_id: community_id, payment_gateway: :paypal))
.map {|res| res[:success] ? res[:data] : nil}
.select {|set| set[:payment_gateway] == :paypal && set[:commission_from_seller]}
- 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 ask_billing_agreement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ask_billing_agreement
return redirect_to person_payment_settings_path(@current_user) unless PaypalHelper.community_ready_for_payments?(@current_community)
account_response = accounts_api.get(
community_id: @current_community.id,
- 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 create_onboarding
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_onboarding(client_ip_address:)
return if stripe_account_ready
stripe_account_form = StripeAccountFormOnboarding.new(params[:stripe_account_form_onboarding])
presenter.stripe_account_form_onboarding = stripe_account_form
- 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 request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def request(body:, flow: :old)
if flow == :new
# TODO partnerLogoUrl
onboarding_link = @onboarding.create_onboarding_link({
returnToPartnerUrl: body[:callback_url]})
- 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 flash_error_and_redirect_to_settings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def flash_error_and_redirect_to_settings(error_response: nil, error_msg: nil)
error_msg =
if (error_msg)
error_msg
elsif (error_response && error_response[:error_code] == "570058")
- 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 perform_redirect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perform_redirect
MarketplaceRouter.perform_redirect(community: @current_community,
plan: @current_plan,
request: request) do |target|
if target[:message] && params[:action] != 'not_available'
- 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 delete_member_title
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete_member_title(membership)
if can_delete_pending(membership)
nil
else
title = has_membership_unfinished_transactions(membership) ? I18n.t('admin.communities.manage_members.have_ongoing_transactions') : nil
- 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 create_person
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_person
given_name = info.first_name.presence || 'N/A'
family_name = info.last_name.presence || 'N/A'
username = UserService::API::Users.username_from_fb_data(
username: data.username,
- 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 valid_email_domain?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def valid_email_domain?(email)
if @ses_client
fulldomain = email.split("@").second
if fulldomain.include?("yahoo.") || fulldomain.include?("gmail.") || fulldomain.include?("googlemail.")
- 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 find_payment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_payment(opts)
commission_payment_id = opts[:data].try(:[], :commission_payment_id)
payment_id = opts[:data].try(:[], :payment_id)
if opts[:community_id] && opts[:transaction_id]
PaypalPaymentModel.where(community_id: opts[:community_id], transaction_id: opts[:transaction_id]).first
- 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 author_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def author_hash(l, includes)
if includes.include?(:num_of_reviews) || includes.include?(:author)
{
author: {
id: l.author_id,
- 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 update_account_capabilities
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_account_capabilities(community:, account_id:)
with_stripe_payment_config(community) do |payment_settings|
account = Stripe::Account.retrieve(account_id)
capabilities = account.capabilities
unless capabilities['card_payments'] == 'active' && capabilities['platform_payments'] == 'active'
- 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 search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search(community_id:, search:, includes: nil)
included_models = includes.map { |m| INCLUDE_MAP[m] }
if DatabaseSearchHelper.needs_db_query?(search) && DatabaseSearchHelper.needs_search?(search)
return Result::Error.new(ArgumentError.new("Both DB query and search engine would be needed to fulfill the search"))
- 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 release_version!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def release_version!(cid, version_number)
LandingPage.transaction do
lp = LandingPage.where(community_id: cid).first
unless lp
- 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 category_image
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def category_image(index)
return nil unless section.categories[index]
asset_id = section.categories[index].asset_id
return nil if asset_id.nil?
- 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 title
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def title(default_value, extra_mode = nil, locale = I18n.locale)
@locale = locale
custom_value =
if mode == 'default' && extra_mode == :social
# social media title is passed here from layout
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create(community, marketplace_type)
transaction_type = select_listing_shape_template(marketplace_type)
enable_shipping = marketplace_type.or_else("product") == "product"
throw "Transaction type '#{transaction_type}' not available. Available types are: #{DEFAULTS.keys.join(', ')}" unless DEFAULTS.key?(transaction_type)
author_is_seller = transaction_type != "Request"
- 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 validate_before_preauthorized
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_before_preauthorized(transaction, transition)
Listing.lock.find(transaction.listing_id)
unless transaction.valid? && (transaction.booking ? transaction.booking.valid? : true)
raise Statesman::TransitionFailedError.new(transaction.current_state, transition.to_state)
end
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
if params[:delete_review] &&
(params[:testimonial][:blocked].nil? || params[:testimonial][:blocked] == '0')
testimonial.destroy && testimonial.tx.reload
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 description
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def description(default_value, extra_mode = nil, locale = I18n.locale)
@locale = locale
custom_value =
if mode == 'default' && extra_mode == :social
# social media description is passed here from layout
- 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"