app/services/stripe_service/api/stripe_api_wrapper.rb
Class StripeApiWrapper
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
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
File stripe_api_wrapper.rb
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
Method register_seller
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method register_seller_bounding
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def register_seller_bounding(community:, account_info:, metadata: {})
with_stripe_payment_config(community) do
case charges_mode(community)
when :separate
payout_mode = {}
Method update_account_capabilities
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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"