Showing 700 of 1,230 total issues
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 verify
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify(conversation_id)
token = APP_CONFIG.admin_intercom_access_token
admin_id = APP_CONFIG.admin_intercom_admin_id
intercom = Intercom::Client.new(token: token)
- 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 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 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 verify_address
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_address(email:)
if email.blank?
raise ArgumentError.new("Missing mandatory value for email parameter.")
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 disable_email_forwarding
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def disable_email_forwarding(email:)
if email.blank?
raise ArgumentError.new("Missing mandatory value for email parameter.")
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_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_model(maybe_model, opts, find_params)
entity = PaypalAccountUpdate.call(opts)
case maybe_model
when Some
- 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 log_result
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def log_result(result, method, request_id)
if result.success
Rails.logger.info(to_json_log_entry(:response,
method,
{ successful: true },
- 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 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 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 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 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 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 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"
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 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 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"