sharetribe/sharetribe

View on GitHub
app/services/stripe_service/api/stripe_api_wrapper.rb

Summary

Maintainability
C
1 day
Test Coverage

Class StripeApiWrapper has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

class StripeService::API::StripeApiWrapper
  DEFAULT_MCC = 5734 # Computer Software Stores
  API_2019_12_03 = '2019-12-03'.freeze
  API_2019_02_19 = '2019-02-19'.freeze

Severity: Minor
Found in app/services/stripe_service/api/stripe_api_wrapper.rb - About 4 hrs to fix

    File stripe_api_wrapper.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class StripeService::API::StripeApiWrapper
      DEFAULT_MCC = 5734 # Computer Software Stores
      API_2019_12_03 = '2019-12-03'.freeze
      API_2019_02_19 = '2019-02-19'.freeze
    
    
    Severity: Minor
    Found in app/services/stripe_service/api/stripe_api_wrapper.rb - About 2 hrs to fix

      Method register_seller has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def register_seller(community:, account_info:, metadata: {})
            with_stripe_payment_config(community) do |payment_settings|
              case charges_mode(community)
              when :separate
                # platform holds captured funds until completion, up to 90 days, then makes transfer
      Severity: Minor
      Found in app/services/stripe_service/api/stripe_api_wrapper.rb - About 1 hr to fix

        Method register_seller_bounding has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def register_seller_bounding(community:, account_info:, metadata: {})
              with_stripe_payment_config(community) do
                case charges_mode(community)
                when :separate
                  payout_mode = {}
        Severity: Minor
        Found in app/services/stripe_service/api/stripe_api_wrapper.rb - About 1 hr to fix

          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'
          Severity: Minor
          Found in app/services/stripe_service/api/stripe_api_wrapper.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

          There are no issues that match your filters.

          Category
          Status