bhollis/maruku

View on GitHub

Showing 121 of 121 total issues

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

                      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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                if self.label  # then numerate
                                  span = xelem('span')
                                  span['class'] = 'maruku-eq-number'
                                  span << xtext("(#{self.num})")
                                  div << span
                      Severity: Minor
                      Found in lib/maruku/ext/math/to_html.rb and 1 other location - About 25 mins to fix
                      lib/maruku/ext/math/to_html.rb on lines 137..142

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 29.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                if self.label  # then numerate
                                  span = xelem('span')
                                  span['class'] = 'maruku-eq-number'
                                  span << xtext("(#{self.num})")
                                  div << span
                      Severity: Minor
                      Found in lib/maruku/ext/math/to_html.rb and 1 other location - About 25 mins to fix
                      lib/maruku/ext/math/to_html.rb on lines 123..128

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 29.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                        :handler => lambda do |doc, src, con|
                          return false unless doc.is_math_enabled?
                          refid = src.read_regexp(RegRef).captures.compact.first
                          con.push doc.md_el(:divref, [], :refid => refid)
                          true
                      Severity: Minor
                      Found in lib/maruku/ext/math/parsing.rb and 1 other location - About 15 mins to fix
                      lib/maruku/ext/math/parsing.rb on lines 100..104

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 26.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language