bhollis/maruku

View on GitHub

Showing 121 of 121 total issues

Method process_markdown_inside_elements has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def process_markdown_inside_elements(doc)
      elts = []
      @fragment.each_element('//*[@markdown]') do |e|
        elts << e
      end
Severity: Minor
Found in lib/maruku/html.rb - About 3 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 line_md_type has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def line_md_type
      # The order of evaluation is important (:text is a catch-all)
      return :text           if self =~ /\A[a-zA-Z]/
      return :empty          if self =~ /\A\s*\z/
      return :footnote_text  if self =~ FootnoteText
Severity: Minor
Found in lib/maruku/input/mdline.rb - About 3 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 array_to_latex has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def array_to_latex(array, join_char='')
    e = []
    array.each do |c|
      if c.kind_of?(String)
        e << string_to_latex(c)
Severity: Minor
Found in lib/maruku/output/to_latex.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 read_table has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def read_table(src)
    head = split_cells(src.shift_line).map do |s|
      md_el(:head_cell, parse_span(s))
    end

Severity: Major
Found in lib/maruku/input/parse_block.rb - About 2 hrs to fix

    Method read_simple has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_simple(src, escaped, exit_on_chars=nil, exit_on_strings=nil, warn=true)
        text = ""
        escaped = Array(escaped)
        exit_on_chars = Array(exit_on_chars)
        exit_on_strings = Array(exit_on_strings)
    Severity: Minor
    Found in lib/maruku/input/parse_span.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 handle_tag has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_tag
          @already << @m.pre_match
          @rest = @m.post_match
    
          is_closing = !!@m[1]
    Severity: Minor
    Found in lib/maruku/input/html_helper.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 read_raw_html has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_raw_html(src)
        extra_line = nil
        h = HTMLHelper.new
        begin
          l = src.shift_line
    Severity: Minor
    Found in lib/maruku/input/parse_block.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 wrap has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def wrap(array, line_length, context)
        out = ""
        line = ""
        array.each do |c|
          if c.kind_of?(MaRuKu::MDElement) &&  c.node_type == :linebreak
    Severity: Minor
    Found in lib/maruku/output/to_markdown.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 array_to_md has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def array_to_md(array, context, join_char='')
        e = []
        array.each do |c|
          if c.is_a?(String)
            e << c
    Severity: Minor
    Found in lib/maruku/output/to_markdown.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 read_image has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_image(src, con)
        src.ignore_chars(2) # opening "!["
        alt_text = read_span(src, EscapedCharInText, ']')
        src.ignore_char # closing bracket
        # ignore space
    Severity: Minor
    Found in lib/maruku/input/parse_span.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 read_link has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_link(src, con)
        # we read the string and see what happens
        src.ignore_char # opening bracket
        children = read_span(src, EscapedCharInText, ']')
        src.ignore_char # closing bracket
    Severity: Minor
    Found in lib/maruku/input/parse_span.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 inspect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def inspect
          if INSPECT_FORMS.has_key? @node_type
            name, *params = INSPECT_FORMS[@node_type]
    
            params = params.map do |p|
    Severity: Minor
    Found in lib/maruku/inspect_element.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 each_element has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def each_element(e_node_type=nil, &block)
          @children.each do |c|
            if c.is_a? MDElement then
              yield c if e_node_type.nil? || c.node_type == e_node_type
              c.each_element(e_node_type, &block)
    Severity: Minor
    Found in lib/maruku/element.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 read_attribute_list has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def read_attribute_list(src, con=nil, break_on_chars=nil)
          break_on_chars = Array(break_on_chars)
          separators = break_on_chars + ['=', ' ', "\t"]
          escaped = Maruku::EscapedCharInQuotes
    
    
    Severity: Major
    Found in lib/maruku/attributes.rb - About 2 hrs to fix

      Method read_link has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def read_link(src, con)
          # we read the string and see what happens
          src.ignore_char # opening bracket
          children = read_span(src, EscapedCharInText, ']')
          src.ignore_char # closing bracket
      Severity: Minor
      Found in lib/maruku/input/parse_span.rb - About 1 hr to fix

        Method to_html_document_tree has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def to_html_document_tree
            root = xelem('html')
            root['xmlns'] = 'http://www.w3.org/1999/xhtml'
            root['xmlns:svg'] = "http://www.w3.org/2000/svg"
            root['xml:lang'] = self.attributes[:lang] || 'en'
        Severity: Minor
        Found in lib/maruku/output/to_html.rb - About 1 hr to fix

          Method read_xml_instruction has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def read_xml_instruction(src, output)
              m = /^\s*<\?((\w+)\s*)?(.*)$/.match src.shift_line
              raise "BugBug" unless m
              target = m[2] || ''
              code = m[3]
          Severity: Minor
          Found in lib/maruku/input/parse_block.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 md_div has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def md_div(children, al = nil)
                type = label = num = nil
                doc.refid2ref ||= {}
                if al
                  al.each do |k, v|
          Severity: Minor
          Found in lib/maruku/ext/div.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 read_image has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def read_image(src, con)
              src.ignore_chars(2) # opening "!["
              alt_text = read_span(src, EscapedCharInText, ']')
              src.ignore_char # closing bracket
              # ignore space
          Severity: Minor
          Found in lib/maruku/input/parse_span.rb - About 1 hr to fix

            Method read_indented_content has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def read_indented_content(src, indentation, break_list, item_type, ial_offset=0)
                lines = []
                # collect all indented lines
                saw_empty = false
                saw_anything_after = false
            Severity: Minor
            Found in lib/maruku/input/parse_block.rb - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language