Showing 133 of 181 total issues
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 37 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'),
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 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 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
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
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 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 convert_units
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_units(new_article = shared_article)
return unless unit != new_article.unit
return false if new_article.unit.include?(',')
# legacy, used by foodcoops in Germany
Function reset
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.List.prototype.plugins.reset = function(locals, options) {
var list = this;
var init = {
start: function(options) {
Method sync_from_file
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sync_from_file(file, options = {})
all_order_numbers = []
updated_article_pairs = []
outlisted_articles = []
new_articles = []
Method init_dates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def init_dates
self.starts ||= Time.now
if FoodsoftConfig[:order_schedule]
# try to be smart when picking a reference day
last = begin
- 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 parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(file, options = {})
SpreadsheetFile.parse file, options do |row, row_index|
next if row[2].blank?
article = { order_number: row[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"