Class Ruleset
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Ruleset < ActiveRecord::Base
include ESA::Traits::Extendable
attr_accessible :name, :type, :chart
attr_readonly :name, :type, :chart
- Create a ticketCreate a ticket
Method stateful_events
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def stateful_events(accountable)
self.event_times(accountable).map do |nature,times|
if times.present? and times.is_a? Time
{nature: nature, time: times}
elsif times.present? and times.respond_to? :each
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def flag_transactions(flag)
if flag.adjusted?
flag_transactions_when_adjusted(flag)
elsif flag.is_set? and (flag.became_set? or (flag.event.present? and flag.event.nature.adjustment?))
flag_transactions_when_set(flag)
- 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"