Showing 6 of 6 total issues
Method creators_hash
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def creators_hash
return @_creators_hash if @_creators_hash.present?
@_creators_hash ||=
array = creators.split('(').map {|x| x.split(')')}.flatten.map {|x| x.strip}
hash ={}
- 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 creators_hash
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def creators_hash
return @_creators_hash if @_creators_hash.present?
@_creators_hash ||=
array = creators.split('(').map {|x| x.split(')')}.flatten.map {|x| x.strip}
hash ={}
Method is_variant?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_variant?
return @is_variant unless @is_variant.nil?
@is_variant = true if hash[:title].include? "VAR ED"
@is_variant = true if hash[:title].include? "COMBO PACK"
@is_variant = true if hash[:title].include? "STANDARD ED"
- 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 ISSUE_CODE if is_issue?
Method sort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sort
return hash[:category_code] unless hash[:category_code].nil?
return ISSUE_CODE if is_variant?
return COLLECTION_CODE if is_collection?
return "16" if is_merch?
- 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 subscribed_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def subscribed_class
return nil unless user
if subscribed?
"subscribed"
else
- 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"