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

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

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

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

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

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

Severity
Category
Status
Source
Language