18F/jekyll_pages_api

View on GitHub
lib/jekyll_pages_api/generated_page_parser.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method parse_content_from_body has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_content_from_body(content, body_element_tag)
      body = parse_basic_tag 'body', content
      return content if body.nil?
      start_body = body.index body_element_tag unless body_element_tag.empty?
      return body if start_body.nil?
Severity: Minor
Found in lib/jekyll_pages_api/generated_page_parser.rb - About 2 hrs 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 parse_meta_tags has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_meta_tags(head_element)
      open_tag = "<meta "
      open_i = head_element.index open_tag
      meta_tags = {}

Severity: Minor
Found in lib/jekyll_pages_api/generated_page_parser.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 parse_content_from_body has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.parse_content_from_body(content, body_element_tag)
      body = parse_basic_tag 'body', content
      return content if body.nil?
      start_body = body.index body_element_tag unless body_element_tag.empty?
      return body if start_body.nil?
Severity: Minor
Found in lib/jekyll_pages_api/generated_page_parser.rb - About 1 hr to fix

    Method parse_meta_tags has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.parse_meta_tags(head_element)
          open_tag = "<meta "
          open_i = head_element.index open_tag
          meta_tags = {}
    
    
    Severity: Minor
    Found in lib/jekyll_pages_api/generated_page_parser.rb - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status