Method write_to_database
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def write_to_database(key, options)
is_file = !options[:kind].nil? && (options[:kind] == 'image' || options[:kind] == 'file')
if is_file
options[:raw] = ''
file = options[:value]
- 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 method_missing
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(key, *args)
key = key.to_s
if key.end_with?('_enabled?')
key = key[0..-10]
v = get(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"
Further reading
Method write_to_database
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write_to_database(key, options)
is_file = !options[:kind].nil? && (options[:kind] == 'image' || options[:kind] == 'file')
if is_file
options[:raw] = ''
file = options[:value]
Method method_missing
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def method_missing(key, *args)
key = key.to_s
if key.end_with?('_enabled?')
key = key[0..-10]
v = get(key)
Method get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get(key, options = {})
load!
key = key.to_s
mutex.synchronize do
@locked = true
- 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 set
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set(key, value = nil, options = {})
load! unless @locked
key = key.to_s
options.symbolize_keys!
- 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"