bhollis/maruku

View on GitHub

Showing 121 of 121 total issues

Method read_span has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring.
Open

  def read_span(src, escaped, exit_on_chars=nil, exit_on_strings=nil)
    escaped = Array(escaped)
    con = SpanContext.new
    dquote_state = squote_state = :closed
    c = d = prev_char = nil
Severity: Minor
Found in lib/maruku/input/parse_span.rb - About 3 days 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

File parse_span.rb has 596 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module MaRuKu::In::Markdown::SpanLevelParser
  include MaRuKu::Helpers

  EscapedCharInText = '\\`*_{}[]()#.!|:+->'.split(//)
  EscapedCharInQuotes = EscapedCharInText + ["'", '"']
Severity: Major
Found in lib/maruku/input/parse_span.rb - About 1 day to fix

    File to_html.rb has 576 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'maruku/string_utils'
    require 'cgi'
    
    # This module groups all functions related to HTML export.
    module MaRuKu::Out::HTML
    Severity: Major
    Found in lib/maruku/output/to_html.rb - About 1 day to fix

      Method read_span has 244 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def read_span(src, escaped, exit_on_chars=nil, exit_on_strings=nil)
          escaped = Array(escaped)
          con = SpanContext.new
          dquote_state = squote_state = :closed
          c = d = prev_char = nil
      Severity: Major
      Found in lib/maruku/input/parse_span.rb - About 1 day to fix

        File parse_block.rb has 564 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module MaRuKu; module In; module Markdown; module BlockLevelParser
        
          include Helpers
          include MaRuKu::Strings
          include MaRuKu::In::Markdown::SpanLevelParser
        Severity: Major
        Found in lib/maruku/input/parse_block.rb - About 1 day to fix

          Method parse_blocks has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
          Open

            def parse_blocks(src)
              output = BlockContext.new
          
              # run state machine
              while src.cur_line
          Severity: Minor
          Found in lib/maruku/input/parse_block.rb - About 7 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 eat_this has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              def eat_this(line)
                @rest = line + @rest
                things_read = 0
                until @rest.empty?
                  case self.state
          Severity: Minor
          Found in lib/maruku/input/html_helper.rb - About 5 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 a Cognitive Complexity of 34 (exceeds 5 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: Minor
          Found in lib/maruku/input/parse_block.rb - About 5 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

          File to_latex.rb has 355 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'set'
          require 'maruku/output/entity_table'
          
          module MaRuKu::Out::Latex
            module MDDocumentExtensions
          Severity: Minor
          Found in lib/maruku/output/to_latex.rb - About 4 hrs to fix

            Method read_indented_content has a Cognitive Complexity of 30 (exceeds 5 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 4 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 a Cognitive Complexity of 28 (exceeds 5 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: Minor
            Found in lib/maruku/attributes.rb - About 4 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 parse_blocks has 91 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def parse_blocks(src)
                output = BlockContext.new
            
                # run state machine
                while src.cur_line
            Severity: Major
            Found in lib/maruku/input/parse_block.rb - About 3 hrs to fix

              Method to_s5 has 86 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def to_s5(context={})
                    content_only = context[:content_only] != false
                    print_slides = context[:print_slides]
              
                    if content_only
              Severity: Major
              Found in lib/maruku/output/s5/to_s5.rb - About 3 hrs to fix

                Method convert_to_png_blahtex has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  def convert_to_png_blahtex(kind, tex)
                    FileUtils.mkdir_p get_setting(:html_png_dir)
                
                    # first, we check whether this image has already been processed
                    md5sum = Digest::MD5.hexdigest(tex + " params: ")
                Severity: Minor
                Found in lib/maruku/ext/math/mathml_engines/blahtex.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_html has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  def array_to_html(array)
                    e = []
                    array.each do |c|
                      if c.kind_of?(String)
                        e << xtext(c)
                Severity: Minor
                Found in lib/maruku/output/to_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 t2_parse_blocks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                        def t2_parse_blocks(src, output)
                            while src.cur_line
                                l = src.shift_line
                                
                                # ignore empty line
                Severity: Minor
                Found in lib/maruku/input_textile2/t2_parser.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 search_abbreviations has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  def search_abbreviations
                    abbreviations.each do |abbrev, title|
                      reg = Regexp.new(Regexp.escape(abbrev))
                      replace_each_string do |s|
                        # bug if many abbreviations are present (agorf)
                Severity: Minor
                Found in lib/maruku/input/parse_doc.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 eat_this has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def eat_this(line)
                      @rest = line + @rest
                      things_read = 0
                      until @rest.empty?
                        case self.state
                Severity: Major
                Found in lib/maruku/input/html_helper.rb - About 3 hrs to fix

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

                      def process_markdown_inside_elements(doc)
                        # find span elements or elements with 'markdown' attribute
                        elts = @fragment.css("[markdown]")
                  
                        d = @fragment.children.first
                  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

                  Severity
                  Category
                  Status
                  Source
                  Language