Showing 150 of 150 total issues
Method body
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def body
order_articles = @order.order_articles.ordered
text I18n.t('documents.order_matrix.heading'), style: :bold
move_down 5
Method diff
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def diff
current = versions.latest
old = versions.where(["page_id = ? and lock_version < ?", current.page_id, current.lock_version]).order('lock_version DESC').first
if old
- 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 article_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.article_data(order)
article_data = order.order_articles.ordered.includes(:article).map do |oa|
shared_article = oa.article.shared_article
units_to_order = oa.units_to_order
unit_quantity = oa.price.unit_quantity
- 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_synchronized
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_synchronized
begin
Article.transaction do
# delete articles
if params[:outlisted_articles]
- 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 body
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def body
# Start rendering
Ordergroup.joins(:orders).where(:orders => {:id => @order}).select('distinct(groups.id) AS id, groups.name AS name').reorder(:name).each do |ordergroup|
total = 0
Function unlist
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
w.List.prototype.templateEngines.unlist = function(list, settings) {
var h = w.ListJsHelpers;
// start with standard engine, override specific methods afterwards
this.superClass = w.List.prototype.templateEngines.standard;
Method config_input_field
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def config_input_field(form, key, options = {})
return unless @cfg.allowed_key? key
options[:required] ||= false
config_input_field_options form, key, options
config_input_tooltip_options form, 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 update_all
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update_all
invalid_articles = false
begin
Article.transaction do
- 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 autologin_foodsoft
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function autologin_foodsoft()
{
global $db;
$foodsoftUser = get_foodsoft_user();
Method calculate_result
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_result(total = nil)
# return memoized result unless a total is given
return @calculate_result if total.nil? and not @calculate_result.nil?
quantity = tolerance = total_quantity = 0
Method sync_all
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sync_all
updated_articles = Array.new
outlisted_articles = Array.new
new_articles = Array.new
for article in articles.undeleted
Method body
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def body
OrderArticle.joins(:order, :article).where(:orders => {:id => @order}).ordered.order('orders.id, articles.name').each do |order_article|
rows = []
dimrows = []
Method order_send_emails
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def order_send_emails
return unless FoodsoftConfig[:send_order_on_finish]
return unless supplier.order_send_email or FoodsoftConfig[:send_order_on_finish] == 'cc_only'
to = FoodsoftConfig[:send_order_on_finish_cc] || []
to.map! do |a|
- 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 approval_msg
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.approval_msg(c, expand=true)
doexpand = lambda {|t,opts| expand ? c.class.helpers.expand_text(t,opts) : t}
if s = FoodsoftConfig[:ordergroup_approval_payment]
link = c.class.helpers.link_to(I18n.t('foodsoft_signup.payment.msg_link'), payment_link(c))
msg = if FoodsoftConfig[:ordergroup_approval_msg]
- 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 ordered_quantities_different_from_group_orders?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def ordered_quantities_different_from_group_orders?(ordered_mark="!", billed_mark="?", received_mark="?")
if not units_received.nil?
((units_received * price.unit_quantity) == group_orders_sum[:quantity]) ? false : received_mark
elsif not units_billed.nil?
((units_billed * price.unit_quantity) == group_orders_sum[:quantity]) ? false : billed_mark
- 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 body
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def body
# Start rendering
@order.group_orders.ordered.each do |group_order|
total = 0
rows = []
Method included
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base) # :nodoc:
base.class_eval do
# debit membership on ordergroup creation
after_create :debit_membership!, :if => proc { FoodsoftSignup.enabled? :membership_fee }
Method add_financial_transaction!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_financial_transaction!(amount, note, user)
result = self.foodsoft_signup_orig_add_financial_transaction!(amount, note, user)
if FoodsoftSignup.enabled? :approval and FoodsoftSignup.enabled? :membership_fee
if not self.approved? and (diff = amount - FoodsoftConfig[:membership_fee].to_f) > -1e-4
transaction do
- 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 show
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def show
if params[:permalink]
@page = Page.find_by_permalink(params[:permalink])
elsif params[:id]
page = Page.find_by_id(params[: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 show_user
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def show_user(user=@current_user, options = {})
if user.nil?
"?"
elsif FoodsoftConfig[:use_nick]
if options[:full] and options[:markup]
- 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"