Showing 29 of 55 total issues
Method maybe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def maybe(attrs)
events = proxy_association.owner.esa_events
last_event = events.order('time DESC, created_at DESC').first
# make sure that the previous event was not of the same event type
- Read upRead up
- Create a ticketCreate a ticket
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 iterated_balance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def iterated_balance
amounts = map do |a|
if a.is_debit?
a.amount
elsif a.is_credit? and not a.amount.nil?
- Read upRead up
- Create a ticketCreate a ticket
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 contained_ids
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.contained_ids(context, options = {})
if options[:all].present? and options[:all] == true and
context.effective_start_date.present? and
context.effective_end_date.present?
dates = context.effective_start_date..context.effective_end_date
- Read upRead up
- Create a ticketCreate a ticket
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 initialize_defaults
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize_defaults
self.time ||= Time.zone.now if self.time.nil?
self.ruleset ||= Ruleset.extension_instance(self.accountable) if self.ruleset_id.nil? and not self.accountable_id.nil?
self.processed ||= false
end
- Read upRead up
- Create a ticketCreate a ticket
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 balance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def balance
sums = group('esa_amounts.amount is null').
group('esa_amounts.type').
sum(:amount)
- Read upRead up
- Create a ticketCreate a ticket
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 flag_transactions_spec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def flag_transactions_spec(accountable, flag_nature)
function_name = "flag_#{flag_nature}_transactions"
if self.respond_to? function_name
transactions = self.send(function_name, accountable)
- Read upRead up
- Create a ticketCreate a ticket
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 registered_keys_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.registered_keys_for(extension=self)
if extension.is_a? Class
self.esa_extensions.select{|k,v| v == extension.name}.keys
elsif extension.is_a? Object and not extension.is_a? String
registered_keys_for(extension.class)
- Read upRead up
- Create a ticketCreate a ticket
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 make_fragments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.make_fragments(type, accountable)
if accountable.is_a? ActiveRecord::Relation
[accountable.select("`#{accountable.table_name}`.`#{accountable.primary_key}` AS id, '#{type}' AS type").to_sql.squish]
elsif accountable.is_a? ActiveRecord::Base
["SELECT #{accountable.id} AS id, '#{type}' AS type"]
- Read upRead up
- Create a ticketCreate a ticket
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_transactions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.create_transactions(flag)
if not flag.processed and not flag.processed_was
if flag.transition.present? and flag.transition.in? [-1, 0, 1]
produce_transactions(flag).map(&:save).all?
else
- Read upRead up
- Create a ticketCreate a ticket
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"