bhollis/maruku

View on GitHub

Showing 115 of 121 total issues

Avoid too many return statements within this method.
Open

      return :raw_html       if self =~ /\A[ ]{0,3}<\!\-\-/
Severity: Major
Found in lib/maruku/input/mdline.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return :raw_html       if self =~ %r{\A[ ]{0,3}</?\s*\w+}
    Severity: Major
    Found in lib/maruku/input/mdline.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return :text # else, it's just text
      Severity: Major
      Found in lib/maruku/input/mdline.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return :xml_instr      if self =~ /\A\s*<\?/
        Severity: Major
        Found in lib/maruku/input/mdline.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return :ial            if self =~ InlineAttributeList
          Severity: Major
          Found in lib/maruku/input/mdline.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return :header1        if self =~ /\A(=)+/
            Severity: Major
            Found in lib/maruku/input/mdline.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return :header3        if self =~ /\A(#)+\s*\S+/
              Severity: Major
              Found in lib/maruku/input/mdline.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return :olist          if self =~ /\A[ ]{0,3}\d+\.\s+.*/
                Severity: Major
                Found in lib/maruku/input/mdline.rb - About 30 mins to fix

                  Method tell_me_the_future has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def tell_me_the_future
                        s = ""
                        num_e = 0
                  
                        @lines_index.upto(@lines.size - 1) do |i|
                  Severity: Minor
                  Found in lib/maruku/input/linesource.rb - About 25 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 to_html_citation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def to_html_citation
                          span = xelem('span')
                          span['class'] = 'maruku-citation'
                          span << xtext('[')
                          self.cites.each do |c|
                  Severity: Minor
                  Found in lib/maruku/ext/math/to_html.rb - About 25 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 consume_whitespace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def consume_whitespace
                        while c = cur_char
                          break unless (c == ' ' || c == "\t")
                          ignore_char
                        end
                  Severity: Minor
                  Found in lib/maruku/input/charsource.rb - About 25 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 to_latex_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def to_latex_header
                      header_levels = %w(section subsection subsubsection)
                      h = header_levels[self.level - 1] || 'paragraph'
                  
                      title = children_to_latex
                  Severity: Minor
                  Found in lib/maruku/output/to_latex.rb - About 25 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 to_latex_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def to_latex_link
                      id = self.ref_id || children_to_s
                      ref = @doc.refs[sanitize_ref_id(id)] || @doc.refs[sanitize_ref_id(children_to_s)]
                      if ref
                        url = ref[:url]
                  Severity: Minor
                  Found in lib/maruku/output/to_latex.rb - About 25 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 split_cells has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def split_cells(s, allowBlank = false)
                      if allowBlank
                        if /^[|].*[|]$/ =~ s # handle the simple and decorated table cases
                          s.split('|', -1)[1..-2]   # allow blank cells, but only keep the inner elements of the cells
                        elsif /^.*[|]$/ =~ s
                  Severity: Minor
                  Found in lib/maruku/input/parse_block.rb - About 25 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 latex_color has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def latex_color(s, command='color')
                      if s =~ /\A\#([1-9A-F]{1,2})([1-9A-F]{1,2})([1-9A-F]{1,2})\z/i
                        # convert from 0-255 or 0-15 to 0.0-1.0
                        r, g, b = [$1, $2, $3].map {|c| c.hex / (c.length == 1 ? 15.0 : 255.0) }
                        "\\#{command}[rgb]{%0.2f,%0.2f,%0.2f}" % [r, g, b]
                  Severity: Minor
                  Found in lib/maruku/output/to_latex.rb - About 25 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