Showing 182 of 182 total issues
Method parse_recurring_selects!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_recurring_selects!(config)
return unless config
for k in %i[pickup boxfill ends] do
if config[k]
- 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 calculate_result
has 42 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? && !@calculate_result.nil?
quantity = tolerance = total_quantity = 0
Method user_can_vote?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def user_can_vote?(user)
Ordergroup.custom_fields.each do |field|
name = field[:name]
next unless required_ordergroup_custom_fields.include? name
return false if user.ordergroup.nil? || user.ordergroup.settings.custom_fields[name].blank?
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def body
each_order_article do |order_article|
down_or_page
rows = []
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def update_all
invalid_articles = false
Article.transaction do
if params[:articles].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 body
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def body
each_order_article do |order_article|
down_or_page
rows = []
Method update_order_amounts
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_order_amounts
return unless params[:order_articles]
# where to leave remainder during redistribution
rest_to = []
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 ordered_quantities_different_from_group_orders?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ordered_quantities_different_from_group_orders?(ordered_mark = '!', billed_mark = '?', received_mark = '?')
if !units_received.nil?
(units_received * price.unit_quantity) == group_orders_sum[:quantity] ? false : received_mark
elsif !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 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] && 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"
Further reading
Method create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create
@document = Document.new name: params[:document][:name]
@document.parent = Document.find_by_id(params[:document][:parent_id])
data = params[:document][:data]
if data
- 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_collection
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_collection
raise I18n.t('finance.financial_transactions.controller.create_collection.error_note_required') if params[:note].blank?
type = FinancialTransactionType.find_by_id(params[:type_id])
financial_link = nil
Function delay
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.List.prototype.plugins.delay = function(locals, options) {
var list = this;
this.searchTimeout = undefined;
Method initialize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(options = {})
options[:font_size] ||= FoodsoftConfig[:pdf_font_size].try(:to_f) || 12
options[:page_size] ||= FoodsoftConfig[:pdf_page_size] || 'A4'
options[:skip_page_creation] = true
@options = options
Method import_data!
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_data!(data)
return 0 if data.empty?
booked = data.fetch(:transactions, {}).fetch(:booked, [])
Method units_history_line
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def units_history_line(order_article, options = {})
if order_article.order.open?
nil
else
units_info = []
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def update
@task = Task.find(params[:id])
task_group = @task.periodic_task_group
was_periodic = @task.periodic?
prev_due_date = @task.due_date
- 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_article_and_price!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_article_and_price!(order_article_attributes, article_attributes, price_attributes = nil)
OrderArticle.transaction do
# Updates self
update!(order_article_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 change
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change
create_table :polls do |t|
t.integer :created_by_user_id, null: false
t.string :name, null: false
t.text :description
Method show
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@items = @financial_link.bank_transactions.map do |bt|
{
date: bt.date,
type: t('activerecord.models.bank_transaction'),