Method cache_control
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def cache_control(options)
return if !Config['production']
if options[:no_cache]
response.headers.delete('ETag')
- 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
File helper.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Olelo
module BlockHelper
def blocks
@blocks ||= Hash.new('')
end
Method pagination
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def pagination(path, page_count, page_nr, options = {})
return if page_count <= 1
unlimited = options.delete(:unlimited)
li = []
li << if page_nr > 1
- 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 build_path
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def build_path(page, options = {})
options = options.dup
action = options.delete(:action)
version = options.delete(:version)
path = (page.try(:path) || page).to_s
- 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 cache_control
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cache_control(options)
return if !Config['production']
if options[:no_cache]
response.headers.delete('ETag')
Method pagination
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pagination(path, page_count, page_nr, options = {})
return if page_count <= 1
unlimited = options.delete(:unlimited)
li = []
li << if page_nr > 1
Method define_set_accessors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def define_set_accessors(*accessors)
accessors.compact.each do |key|
key = key.to_sym
class_eval do
define_method(key) {|*val| val.size > 0 ? (self[key] ||= Set.new).merge(val) : self[key] }
- 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"