bhollis/maruku

View on GitHub

Showing 121 of 121 total issues

Method to_html_code has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def to_html_code
    source = self.raw_code

    code_lang = self.lang || self.attributes[:lang] || @doc.attributes[:code_lang]

Severity: Minor
Found in lib/maruku/output/to_html.rb - About 1 hr to fix

    Method read_paragraph has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_paragraph(src)
        lines = [src.shift_line]
        while src.cur_line
          # :olist does not break
          case t = src.cur_line.md_type
    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 pick_apart_non_inline_html has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def pick_apart_non_inline_html(children)
        output = []
        para_children = []
    
        children.each do |child|
    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 parse_doc has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def parse_doc(s)
        # Remove BOM if it is present
        s = s.sub(/^\xEF\xBB\xBF/u, '')
        meta2 = parse_email_headers(s)
        data = meta2.delete :data
    Severity: Minor
    Found in lib/maruku/input/parse_doc.rb - About 1 hr to fix

      Method convert_to_mathml_itex2mml has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def convert_to_mathml_itex2mml(kind, tex)
          return if $already_warned_itex2mml
          begin
            require 'itextomml'
          rescue LoadError => e
      Severity: Minor
      Found in lib/maruku/ext/math/mathml_engines/itex2mml.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 render_footnotes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def render_footnotes
          div = xelem('div')
          div['class'] = 'footnotes'
          div << xelem('hr')
          ol = xelem('ol')
      Severity: Minor
      Found in lib/maruku/output/to_html.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 convert_to_png_blahtex has 38 lines of code (exceeds 25 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 1 hr to fix

        Method to_html_code has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def to_html_code
            source = self.raw_code
        
            code_lang = self.lang || self.attributes[:lang] || @doc.attributes[:code_lang]
        
        
        Severity: Minor
        Found in lib/maruku/output/to_html.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 to_s5 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def to_s5(context={})
              content_only = context[:content_only] != false
              print_slides = context[:print_slides]
        
              if content_only
        Severity: Minor
        Found in lib/maruku/output/s5/to_s5.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 process_markdown_inside_elements has 35 lines of code (exceeds 25 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 1 hr to fix

          Method expand_attribute_list has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def expand_attribute_list(al, result)
              al.each do |k, v|
                case k
                when :class
                  if result[:class]
          Severity: Minor
          Found in lib/maruku/input/parse_doc.rb - About 1 hr to fix

            Method handle_tag has 32 lines of code (exceeds 25 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 1 hr to fix

              Method method_missing has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def method_missing(methodname, *args)
                    a_bef = @a.describe
                    b_bef = @b.describe
              
                    a = @a.send(methodname, *args)
              Severity: Minor
              Found in lib/maruku/input/charsource.rb - About 1 hr to fix

                Method parse_doc has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def parse_doc(s)
                    # Remove BOM if it is present
                    s = s.sub(/^\xEF\xBB\xBF/u, '')
                    meta2 = parse_email_headers(s)
                    data = meta2.delete :data
                Severity: Minor
                Found in lib/maruku/input/parse_doc.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 merge_ial has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def merge_ial(elements, src, con)
                      # Apply each IAL to the element before
                      (elements + [nil]).each_cons(3) do |before, e, after|
                        next unless ial?(e)
                
                
                Severity: Minor
                Found in lib/maruku/attributes.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 render_footnotes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def render_footnotes
                    div = xelem('div')
                    div['class'] = 'footnotes'
                    div << xelem('hr')
                    ol = xelem('ol')
                Severity: Minor
                Found in lib/maruku/output/to_html.rb - About 1 hr to fix

                  Method create_toc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def create_toc
                        self.header_ids = Hash.new(0)
                  
                        each_element(:header) {|h| h.attributes[:id] ||= h.generate_id }
                  
                  
                  Severity: Minor
                  Found in lib/maruku/toc.rb - About 1 hr to fix

                    Method read_simple has 29 lines of code (exceeds 25 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 1 hr to fix

                      Method read_definition has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def read_definition(src)
                          # Read one or more terms
                          terms = []
                          while src.cur_line && src.cur_line.md_type == :text
                            terms << md_el(:definition_term, parse_span(src.shift_line))
                      Severity: Minor
                      Found in lib/maruku/input/parse_block.rb - About 1 hr to fix

                        Method wrap has 28 lines of code (exceeds 25 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 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language