18F/jekyll_pages_api

View on GitHub

Showing 6 of 6 total issues

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

      Method each_site_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def each_site_file
            Dir.glob(File.join(self.basedir, '**', '*')) do |f|
              next unless f.end_with? '.html'
              begin
                page = GeneratedPage.new(f, self.basedir, self.title_prefix,
      Severity: Minor
      Found in lib/jekyll_pages_api/generated_site.rb - About 55 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(path, basedir, title_prefix, body_element_tag, content)
      Severity: Minor
      Found in lib/jekyll_pages_api/generated_page.rb - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language