Method get
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.get(keyname)
value = typename = nil
s = Rails.cache.read("#{Prefix_Key}#{keyname}")
if 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 get
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get(keyname)
value = typename = nil
s = Rails.cache.read("#{Prefix_Key}#{keyname}")
if s
Method value_by_typename_is_valid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def value_by_typename_is_valid
case typename
when "Text"
when "String"
when "Boolean"
- 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 check_length
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_length
case keyname
when 'checkouts_print.message'
if v.length > 152
errors[:base] = I18n.t('system_configuration.error.over_checkouts_print_message', :num => 76)
- 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
Avoid too many return
statements within this method. Open
return v
Avoid too many return
statements within this method. Open
return value.to_i