Showing 203 of 346 total issues
Method update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
all_selected = true
if params[:shipping_category].present?
params[:shipping_category].each_pair do |category_id, rate_id|#[rate]
if rate_id.present?
- 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 sanitize_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sanitize_data
self.email = self.email.strip.downcase unless email.blank?
self.first_name = self.first_name.strip.capitalize unless first_name.nil?
self.last_name = self.last_name.strip.capitalize unless last_name.nil?
- 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 update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
all_selected = true
redirect_to(shopping_orders_url) and return unless params[:shipping_category].present?
params[:shipping_category].each_pair do |category_id, rate_id|#[rate]
if rate_id.present?
- 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
Consider simplifying this complex logical expression. Open
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {
dataType = dataType || mimeToDataType(xhr.getResponseHeader('content-type'))
result = xhr.responseText
try {
Function remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
Function anim
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function anim(el, speed, opacity, scale, callback) {
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
jQuery.event.add = function( elem, types, handler, data, selector ){
Function jq_param_sub
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function jq_param_sub( is_fragment, get_func, url, params, merge_mode ) {
Function _w
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var _w = function(f, a1, a2, a3, a4)
Function remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function remove(element, events, fn, selector, capture){
Method add_cart_items
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_cart_items(items, qty, customer, cart_item_type_id, variant_id)
Method new_transaction_ledgers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def new_transaction_ledgers( transactor, credit_transaction_account_id, debit_transaction_account_id, amount, at)
Method add_variant
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_variant(variant_id, customer, qty = 1, cart_item_type_id = ItemType::SHOPPING_CART_ID, admin_purchase = false)
Method session_cart!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def session_cart!
if cookies[:cart_id]
@session_cart = Cart.includes(:shopping_cart_items).find_by_id(cookies[:cart_id])
unless @session_cart
@session_cart = Cart.create(:user_id => current_user_id)
- 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 items_to_add_or_destroy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def items_to_add_or_destroy(items_in_cart, order)
#destroy_any_order_item_that_was_removed_from_cart
destroy_order_items_not_in_cart!(items_in_cart, order)
# order.order_items.delete_all #destroy(order_item.id)
items = order.order_items.inject({}) {|h, item| h[item.variant_id].nil? ? h[item.variant_id] = [item.id] : h[item.variant_id] << item.id; h}
- 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 charge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def charge( amount, profile_key, options ={})
options[:order_id] ||= unique_order_number
if GATEWAY.respond_to?(:purchase)
process( 'charge', amount ) do |gw|
gw.purchase( amount, profile_key, options )
- 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 remove_items
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove_items(variant, final_quantity)
current_qty = 0
items_to_remove = []
self.order_items.each_with_index do |order_item, i|
- 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
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return $(this.scope).width() < settings.small_breakpoint;
Avoid too many return
statements within this function. Open
return false;