Showing 5 of 5 total issues
Method truncate_array
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def truncate_array(string_array, limit = nil, separator = "")
return string_array if limit.nil? || limit <= 0
length = 0
result = []
- 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 render_alternate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_alternate(tags)
alternate = meta_tags.extract(:alternate)
return unless alternate
if alternate.is_a?(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 truncate_title
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def truncate_title(site_title, title, separator)
global_limit = MetaTags.config.title_limit.to_i
if global_limit > 0
site_title_limited_length, title_limited_length = calculate_title_limits(
site_title, title, separator, global_limit
- 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 calculate_title_limits
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_title_limits(site_title, title, separator, global_limit)
# What should we truncate first: site title or page title?
main_title = MetaTags.config.truncate_site_title_first ? title : [site_title]
main_length = main_title.map(&:length).sum + ((main_title.size - 1) * separator.length)
- 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 process_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_hash(tags, property, content, **opts)
itemprop = content.delete(:itemprop)
content.each do |key, value|
if key.to_s == "_"
iprop = itemprop
- 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"