Showing 133 of 181 total issues
Method ordergroup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ordergroup
@user = @current_user
@ordergroup = @user.ordergroup
if @ordergroup.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_synchronized
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_synchronized
@outlisted_articles = Article.find(params[:outlisted_articles].try(:keys) || [])
@updated_articles = Article.find(params[:articles].try(:keys) || [])
@updated_articles.map { |a| a.assign_attributes(params[:articles][a.id.to_s]) }
@new_articles = (params[:new_articles] || []).map { |a| @supplier.articles.build(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 sync_all
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sync_all
updated_article_pairs = []
outlisted_articles = []
new_articles = []
existing_articles = Set.new
- 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 index
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort = if params['sort']
case params['sort']
when 'name' then 'articles.name'
when 'unit' then 'articles.unit'
Method unequal_attributes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def unequal_attributes(new_article, options = {})
# try to convert different units when desired
if options[:convert_units] == false
new_price = nil
new_unit_quantity = nil
Method index
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort = if params['sort']
case params['sort']
when 'date' then 'created_on'
when 'note' then 'note'
Method received
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def received(data)
mail = Mail.new data
mail_part = get_mail_part(mail)
raise 'No valid content could be found' if mail_part.nil?
Method import
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import
@bank_account = BankAccount.find(params[:id])
importer = @bank_account.find_connector
if importer
Method index
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort = if params['sort']
case params['sort']
when 'date' then 'date'
when 'amount' then 'amount'
Method sum
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sum(type = :gross)
total = 0
if %i[net gross fc].include?(type)
for oa in order_articles.ordered.includes(:article, :article_price)
quantity = oa.units * oa.price.unit_quantity
Function addData
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function addData(orderArticleId, itemPrice, itemUnit, itemSubtotal, itemQuantityOthers, itemToleranceOthers, allocated, available) {
Consider simplifying this complex logical expression. Open
unless (delta_q == 0 && delta_t >= 0) ||
(delta_mis < 0 && delta_box >= 0 && delta_t >= 0) ||
(delta_q > 0 && delta_q == -delta_t)
raise ActiveRecord::RecordNotSaved.new("Change not acceptable in boxfill phase for '#{article.name}', sorry.",
self)
Function data_delta_update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function data_delta_update(el, direction) {
var id = $(el).attr('id');
var min = $(el).data('min');
var max = $(el).data('max');
- 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 mail
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mail(args)
args[:message_id] ||= "<#{Mail.random_tag}@#{default_url_options[:host]}>"
args[:subject] = "[#{FoodsoftConfig[:name]}] #{args[:subject]}"
if args[:from].is_a? User
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def body
contact = FoodsoftConfig[:contact].symbolize_keys
# From paragraph
bounding_box [margin_box.right - 200, margin_box.top], width: 200 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 navigation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def navigation(primary, context)
return unless FoodsoftMessages.enabled?
unless primary[:foodcoop].nil?
sub_nav = primary[:foodcoop].sub_navigation
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def body
each_order_article do |order_article|
dimrows = []
rows = [[
GroupOrder.human_attribute_name(:ordergroup),
- 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 perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform(order)
order.group_orders.each do |group_order|
next unless group_order.ordergroup
group_order.ordergroup.users.each do |user|
- 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 perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform(order)
order.group_orders.each do |group_order|
next unless group_order.ordergroup
group_order.ordergroup.users.each do |user|
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def update
@page = Page.find(params[:id])
@page.attributes = params[:page].merge({ user: current_user })
if params[:preview]
- 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"