Showing 133 of 181 total issues
Method update_quantities
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_quantities(quantity, tolerance)
logger.debug("GroupOrderArticle[#{id}].update_quantities(#{quantity}, #{tolerance})")
logger.debug("Current quantity = #{self.quantity}, tolerance = #{self.tolerance}")
# When quantity and tolerance are zero, we don't serve any purpose
Class Ordergroup
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Ordergroup < Group
include CustomFields
APPLE_MONTH_AGO = 6 # How many month back we will count tasks and orders sum
Method import_data!
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def import_data!(data)
return 0 if data.empty?
booked = data.fetch(:transactions, {}).fetch(:booked, [])
- 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 assign_to_ordergroup
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def assign_to_ordergroup
m = BankTransactionReference.parse(reference)
return unless m
return false if m[:parts].values.sum != amount
- 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 sum
has a Cognitive Complexity of 16 (exceeds 5 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
- 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 convert_units
has a Cognitive Complexity of 16 (exceeds 5 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
- 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
Function update
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update(item, quantity, tolerance) {
// set modification flag
modified = true
// update hidden input fields
Method body
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def body
order_articles_data = [[
OrderArticle.human_attribute_name(:article),
Article.human_attribute_name(:supplier),
ArticlePrice.human_attribute_name(: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 config_input_field
has a Cognitive Complexity of 15 (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
- 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 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
- 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 import
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def import
@bank_account = BankAccount.find(params[:id])
importer = @bank_account.find_connector
if importer
- 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
each_ordergroup do |oa_name, oa_total, oa_id, oa_transport|
has_transport = !oa_transport.nil? && oa_transport > 0
dimrows = []
rows = [[
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;
Function update
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function update(item, quantity, tolerance) {
// set modification flag
modified = true
// update hidden input fields
- 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 vote
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def vote
@poll = Poll.find(params[:id])
if @poll.one_vote_per_ordergroup
ordergroup = current_user.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 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 receive
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def receive
@order = Order.find(params[:id])
if request.post?
Order.transaction do
s = update_order_amounts
- 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"