Method cache_method
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def cache_method(method_name)
if use_caching?
# If a setter method exists as well, make the setter method
# also renew the cache.
- 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 cached_block
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cached_block(options = {}, &block)
# This gives the method name that called the #cached method.
# See: http://www.ruby-doc.org/core-2.1.2/Kernel.html
#
if options[:method_name] && options[:arguments] && options[:arguments].any?
- 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 fill_cached_method
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fill_cached_method(method)
Sidekiq::Logging.logger.info "#{title} # fill_cached_method #{method}" if Sidekiq::Logging.logger && (! Rails.env.test?)
if Rails.cache.running_from_background_job && Rails.cache.renew_at
# When running from a background job, split it into sub-tasks.
self.renew_cache_later method: method
- 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 rescue_from_too_big_to_marshal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rescue_from_too_big_to_marshal(block_without_caching, &block_with_caching)
begin
yield
rescue ArgumentError, NameError => exc
if exc.message.include? 'year too big to marshal'
- 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"