Method lookup_extension
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.lookup_extension(name)
if self.esa_extensions.present?
matches = self.esa_extensions.map do |expr,extension|
if expr.is_a? Regexp and expr.match(name).present?
extension
- 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 extension_name
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.extension_name(accountable)
if accountable.is_a? Class
if accountable.respond_to? :accountable_name
lookup_extension(accountable.accountable_name)
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"
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"