sharetribe/sharetribe

View on GitHub

Showing 700 of 1,230 total issues

Method create_omniauth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_omniauth
    origin_locale = get_origin_locale(request, available_locales())
    I18n.locale = origin_locale if origin_locale

    service = Person::OmniauthService.new(
Severity: Minor
Found in app/controllers/omniauth_controller.rb - About 25 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 validate_recaptcha has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_recaptcha(token)
    return true if @current_user.present?
    return true unless @current_community.recaptcha_configured?

    verify_recaptcha!(response: token,
Severity: Minor
Found in app/controllers/concerns/config_recaptcha.rb - About 25 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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy
    image = ListingImage.find_by_id(params[:id])

    if image.nil?
      render body: nil, status: :not_found
Severity: Minor
Found in app/controllers/listing_images_controller.rb - About 25 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 enter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def enter(ctx)
        req = ctx.fetch(:req)
        opts_encoding = ctx.dig(:opts, :encoding)
        encode_request = Maybe(ctx.dig(:opts, :encode_request)).or_else(@_encode_request)
        encoder = encoder_by_encoding(opts_encoding) || @_default_encoder
Severity: Minor
Found in app/utils/service_client/middleware/body_encoder.rb - About 25 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 next_and_prev has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def next_and_prev(arr, curr)
    if arr.length <= 1
      [nil, nil]
    elsif arr.length == 2
      first, last = arr
Severity: Minor
Found in app/utils/array_utils.rb - About 25 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 code_usable? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.code_usable?(code, community=nil)
    invitation = Invitation.find_by_code(code.upcase) if code.present?
    if invitation.present?
      return false if community.present? && invitation.community_id != community.id

Severity: Minor
Found in app/models/invitation.rb - About 25 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 person_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def person_name(person)
    if person.present? && !person.deleted?
      display_name = person.display_name.present? ? " (#{person.display_name})" : ''
      "#{person.given_name} #{person.family_name}#{display_name}"
    else
Severity: Minor
Found in app/helpers/admin2_helper.rb - About 25 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_listings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_listings(params:, current_page:, listings_per_page:, filter_params:, includes:, location_search_in_use:, keyword_search_in_use:, relevant_search_fields:)

    search = {
      # Add listing_id
      categories: filter_params[:categories],
Severity: Minor
Found in app/controllers/homepage_controller.rb - About 25 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 create_sender_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_sender_address
    user_defined_address = EmailService::API::Api.addresses.get_user_defined(community_id: @current_community.id).data

    if user_defined_address && user_defined_address[:email] == params[:email].to_s.downcase.strip
      EmailService::API::Api.addresses.update(community_id: @current_community.id, id: user_defined_address[:id], name: params[:name])
Severity: Minor
Found in app/controllers/admin/communities_controller.rb - About 25 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 check_extra_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_extra_attributes
      unless cta_enabled
        self.button_title = nil
        self.button_path = nil
      end
Severity: Minor
Found in app/models/landing_page_version/section/info_single_column.rb - About 25 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 new has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def new
    @selected_tribe_navi_tab = "members"
    redirect_to search_path if logged_in?
    session[:invitation_code] = params[:code] if params[:code]
    service_init
Severity: Minor
Found in app/controllers/people_controller.rb - About 25 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 ensure_can_receive_payment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def ensure_can_receive_payment
    payment_type = @current_community.active_payment_types || :none

    ready = TransactionService::Transaction.can_start_transaction(transaction: {
        payment_gateway: payment_type,
Severity: Minor
Found in app/controllers/preauthorize_transactions_controller.rb - About 25 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 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)

Severity: Minor
Found in app/view_utils/intercom_helper.rb - About 25 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 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 },
Severity: Minor
Found in app/services/email_service/ses/logger.rb - About 25 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 sitemap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def sitemap
    return if render_sitemap_disabled!

    com = community_from_request(request)
    reason = redirect_reason_from_request(request)
Severity: Minor
Found in app/controllers/sitemap_controller.rb - About 25 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 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

Severity: Minor
Found in app/services/email_service/ses/client.rb - About 25 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 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
Severity: Minor
Found in app/services/paypal_service/store/paypal_account.rb - About 25 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 community_ready_for_payments? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def community_ready_for_payments?(community_id)
    stripe_active?(community_id) &&
      Maybe(TxApi.settings.get(community_id: community_id, payment_gateway: :stripe, payment_process: :preauthorize))
      .map {|res| res[:success] ? res[:data] : nil}
      .select {|set| set[:commission_from_seller]}
Severity: Minor
Found in app/view_utils/stripe_helper.rb - About 25 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 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

Severity: Minor
Found in app/services/email_service/ses/client.rb - About 25 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 update_footer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_footer
      return if @service.plan_footer_disabled?
      unless @service.update
        raise t('admin2.notifications.footer_update_failed')
      end
Severity: Minor
Found in app/controllers/admin2/design/footer_controller.rb - About 25 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