jeffreytse/jekyll-spaceship

View on GitHub
lib/jekyll-spaceship/processors/table-processor.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method on_handle_markdown has 50 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    def on_handle_markdown(content)
      # pre-handle reference-style links
      references = {}
      content.scan(/\n\s*(\[(.*)\]:\s*(\S+(\s+".*?")?))/) do |match_data|
        ref_name = match_data[1]
Severity: Minor
Found in lib/jekyll-spaceship/processors/table-processor.rb - About 1 hr to fix

    Method handle_attr_list has a Cognitive Complexity of 24 (exceeds 15 allowed). Consider refactoring.
    Open

        def handle_attr_list(data)
          cell = data.cell
          content = cell.inner_html
          # inline attribute list(IAL) handler
          ial_handler = ->(list) do
    Severity: Minor
    Found in lib/jekyll-spaceship/processors/table-processor.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 handle_attr_list has 34 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

        def handle_attr_list(data)
          cell = data.cell
          content = cell.inner_html
          # inline attribute list(IAL) handler
          ial_handler = ->(list) do
    Severity: Minor
    Found in lib/jekyll-spaceship/processors/table-processor.rb - About 1 hr to fix

      Method on_handle_html has 32 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

          def on_handle_html(content)
            # use nokogiri to parse html content
            doc = Nokogiri::HTML(content)
      
            data = self.table_scope_data
      Severity: Minor
      Found in lib/jekyll-spaceship/processors/table-processor.rb - About 1 hr to fix

        Method on_handle_markdown has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
        Open

            def on_handle_markdown(content)
              # pre-handle reference-style links
              references = {}
              content.scan(/\n\s*(\[(.*)\]:\s*(\S+(\s+".*?")?))/) do |match_data|
                ref_name = match_data[1]
        Severity: Minor
        Found in lib/jekyll-spaceship/processors/table-processor.rb - About 45 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

        There are no issues that match your filters.

        Category
        Status