Showing 18 of 168 total issues
Method draw
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw(mount_location, options = {})
routes = self
users = options.fetch(:users, true)
products = options.fetch(:products, true)
Method create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create
if service.call
@quantity = params[:line_item][:quantity].to_i
@line_item = service.line_item
# Allow subclasses to hook into successful product list add
- 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 cart_params
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cart_params(*attributes)
@cart_params ||= super(
*merge_arrays(
[
:use_another_address_for_billing, :terms,
Method validate_nested_forms
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_nested_forms
# If no nested forms are present in the class, just return true since
# no validation should be tested
return true unless nested_forms
- 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 call
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def call
return false unless line_item_valid?
cart.line_items << line_item unless assemble_identical_line_items
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def create
if !service.line_item_params? && (product_id = params[:product_id]).present?
product = Product.find(product_id)
if product.variants.length > 1
- 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 draw
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def draw(mount_location, options = {})
routes = self
users = options.fetch(:users, true)
products = options.fetch(:products, 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 prepare_cart
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def prepare_cart(cart)
cart.tap do
cart.customer = current_customer if current_customer
# Keep track of potential customer locale switching to allow e-mailing
# him in his last used locale
- 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 copy_address
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def copy_address(type)
source.with_actual_address_associations do
target.with_actual_address_associations do
address = if target.send(:"#{ type }_address?")
target.send(:"#{ type }_address")
- 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 prepare_wish_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def prepare_wish_list(wish_list)
wish_list.tap do
wish_list.customer = current_customer if current_customer
# Keep track of potential customer locale switching to allow e-mailing
# him in his last used locale
- 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 load_from
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_from(csv_string)
csv = CSV.parse(csv_string)
headers = csv.shift
headers.each_with_index.each_with_object({}) do |(countries, index), hash|
- 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 for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.for(shipping_method)
identifier = case shipping_method
when String, Symbol then shipping_method.to_s
else shipping_method && shipping_method.identifier
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 find_cart
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_cart(identifier, ensure_active_cart = true)
if (cart_token = cookies.encrypted[cart_key(identifier)])
if (current_cart = ProductList.find_by_token(cart_token)) &&
(!ensure_active_cart || current_cart.active?)
then
- 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 prepare_user_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_user_attributes
return if params[:create_account] == '1'
if cart_params[:customer_attributes] && cart_params[:customer_attributes][:user_attributes]
cart_params[:customer_attributes].delete(:user_attributes)
- 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 with_errors_from_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def with_errors_from_user(customer)
return customer unless (user = customer.user) && user.errors.any?
return unless (messages = user.errors.messages[:email]) && messages.any?
messages.each do |message|
- 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 find_wish_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_wish_list(identifier, ensure_active_wish_list = true)
if (wish_list_token = cookies.encrypted[wish_list_key(identifier)])
if (current_wish_list = ProductList.find_by_token(wish_list_token)) &&
(!ensure_active_wish_list || current_wish_list.active?)
then
- 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 param
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def param(name, default = nil)
attr_writer name
instance_variable_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 up
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def up
change_table :stall_addresses do |t|
t.string :type
t.references :addressable, polymorphic: true
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"