jeffreytse/jekyll-spaceship

View on GitHub

Showing 14 of 18 total issues

Method scan_mathjax_expression has a Cognitive Complexity of 30 (exceeds 15 allowed). Consider refactoring.
Open

    def scan_mathjax_expression(doc, &block)
      patterns = get_math_patterns()
      doc = doc.clone

      # remove code, pre, figure nodes
Severity: Minor
Found in lib/jekyll-spaceship/processors/mathjax-processor.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 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_media has 43 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

        def handle_media(element, data)
          host = data[:host]
          src = element.get_attribute('src')
          title = element.get_attribute('title')
          id = data[:id_from] === 'html' ? '()' : data[:id]
    Severity: Minor
    Found in lib/jekyll-spaceship/processors/media-processor.rb - About 1 hr to fix

      Method dispatch has a Cognitive Complexity of 21 (exceeds 15 allowed). Consider refactoring.
      Open

          def self.dispatch(page, container, event)
            # dispatch to each processor
            @@_processors.each do |processor|
              processor.dispatch page, container, event
              break unless processor.next?
      Severity: Minor
      Found in lib/jekyll-spaceship/cores/manager.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 dispatch_html_block has a Cognitive Complexity of 21 (exceeds 15 allowed). Consider refactoring.
      Open

          def self.dispatch_html_block(page)
            doc = Nokogiri::HTML(page.output)
            doc.css('script').each do |node|
              type = Type.html_block_type node['type']
              content = node.content
      Severity: Minor
      Found in lib/jekyll-spaceship/cores/manager.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 emoji_filter has 35 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

          def emoji_filter(content, selector)
            # use nokogiri to parse html
            doc = Nokogiri::HTML(content)
      
            body = doc.at('body')
      Severity: Minor
      Found in lib/jekyll-spaceship/processors/emoji-processor.rb - About 1 hr to fix

        Method scan_mathjax_expression has 35 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

            def scan_mathjax_expression(doc, &block)
              patterns = get_math_patterns()
              doc = doc.clone
        
              # remove code, pre, figure nodes
        Severity: Minor
        Found in lib/jekyll-spaceship/processors/mathjax-processor.rb - About 1 hr to fix

          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 handle_media has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring.
              Open

                  def handle_media(element, data)
                    host = data[:host]
                    src = element.get_attribute('src')
                    title = element.get_attribute('title')
                    id = data[:id_from] === 'html' ? '()' : data[:id]
              Severity: Minor
              Found in lib/jekyll-spaceship/processors/media-processor.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 handle_hash_element has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
              Open

                  def handle_hash_element(data)
                    doc = data[:doc]
                    element = data[:element]
                    data = data[:data]
              
              
              Severity: Minor
              Found in lib/jekyll-spaceship/processors/element-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

              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

              Method dispatch has a Cognitive Complexity of 17 (exceeds 15 allowed). Consider refactoring.
              Open

                  def dispatch(page, container, event)
                    @page = page
                    @handled = false
                    return unless self.process?
                    method = "on_#{container}_#{event}"
              Severity: Minor
              Found in lib/jekyll-spaceship/cores/processor.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

              Severity
              Category
              Status
              Source
              Language