kpumuk/meta-tags

View on GitHub

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 = [] # : Array[String]
Severity: Minor
Found in lib/meta_tags/text_normalizer.rb - About 1 hr to fix

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
Severity: Minor
Found in lib/meta_tags/text_normalizer.rb - About 35 mins to fix

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)
Severity: Minor
Found in lib/meta_tags/renderer.rb - About 35 mins to fix

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)
Severity: Minor
Found in lib/meta_tags/text_normalizer.rb - About 25 mins to fix

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
Severity: Minor
Found in lib/meta_tags/renderer.rb - About 25 mins to fix
Severity
Category
Status
Source
Language