Showing 6 of 8 total issues
Method initialize
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user)
user ||= Spree.user_class.new
if user.supplier
if SpreeMarketplace::Engine.spree_digital_available?
Method create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :create, Spree::Supplier
@supplier = Spree::Supplier.new(supplier_params)
- 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 stripe_recipient_setup
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def stripe_recipient_setup
return if self.tax_id.blank? and self.address.blank?
recipient = Stripe::Recipient.create(
:name => (self.merchant_type == 'business' ? self.name : "#{self.address.first_name} #{self.address.last_name}"),
- 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 stripe_recipient_update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def stripe_recipient_update
unless new_record? or !changed?
if token.present?
rp = Stripe::Recipient.retrieve(token)
rp.name = name
- 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 initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
user ||= Spree.user_class.new
if user.supplier
if SpreeMarketplace::Engine.spree_digital_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 assign_name
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def assign_name
self.address = Spree::Address.default unless self.address.present?
self.address.first_name = self.first_name unless self.address.first_name.present?
self.address.last_name = self.last_name unless self.address.last_name.present?
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"