bhollis/maruku

View on GitHub
lib/maruku/input/mdline.rb

Summary

Maintainability
C
1 day
Test Coverage

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

Avoid too many return statements within this method.
Open

      return :code           if number_of_leading_spaces >= 4
Severity: Major
Found in lib/maruku/input/mdline.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return :quote          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 :text           if self =~ /\A[ ]{0,3}<\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 :header2        if self =~ /\A([-\s])+\z/
        Severity: Major
        Found in lib/maruku/input/mdline.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return :ulist          if self =~ /\A[ ]{0,3}([\*\-\+])\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 :ald            if self =~ AttributeDefinitionList
            Severity: Major
            Found in lib/maruku/input/mdline.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return :hrule          if self =~ /\A(\s*[\*\-_]\s*){3,}\z/
              Severity: Major
              Found in lib/maruku/input/mdline.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return :abbreviation   if self =~ Abbreviation
                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           if self =~ /\A[ ]{0,3}#{EMailAddress}/
                  Severity: Major
                  Found in lib/maruku/input/mdline.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          return :definition     if self =~ Definition
                    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 =~ /\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

                                      There are no issues that match your filters.

                                      Category
                                      Status