Showing 4 of 27 total issues
Method attach
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
Open
def attach(klazz, *methods, cms: nil)
klazz = Kernel.const_get(klazz) unless klazz.is_a?(Class)
methods = klazz.instance_methods(false) if methods.empty?
do_log = !option(ENV, 'options.silent')
- 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 log_report
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def log_report(count)
count = @@chronoscope_data.size if count <= 0
delim_label = [" ⇓⇓ [#{LOGGER_TAG}] ⇓⇓ ", " ⇑⇑ [#{LOGGER_TAG}] ⇑⇑ "].map do |label|
delim = '—' * ((log_width - label.length) / 2)
Method attach
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def attach(klazz, *methods, cms: nil)
klazz = Kernel.const_get(klazz) unless klazz.is_a?(Class)
methods = klazz.instance_methods(false) if methods.empty?
do_log = !option(ENV, 'options.silent')
Method ⌚
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def ⌚(arg = DEFAULT_TAG, log = false)
return (@@chronoscope_data[arg.to_s] = nil) unless block_given? # pass no block to reset
result = nil # needed for it to be defined in this scope
@@chronoscope_data[arg.to_s] ||= { count: 0, total: 0, stack: @@★.dup }
- 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"