bhollis/maruku

View on GitHub

Showing 121 of 121 total issues

Method convert_to_mathml_itex2mml has 28 lines of code (exceeds 25 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

    Method to_html_link has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def to_html_link
        a = {}
        id = self.ref_id || children_to_s
    
        if ref = @doc.refs[sanitize_ref_id(id)] || @doc.refs[sanitize_ref_id(children_to_s)]
    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_html_equation has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def to_html_equation
            mathml = get_setting(:html_math_output_mathml) && render_mathml(:equation, self.math)
            png    = get_setting(:html_math_output_png)    && render_png(:equation, self.math)
    
            div = xelem('div')
    Severity: Minor
    Found in lib/maruku/ext/math/to_html.rb - About 1 hr to fix

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

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

          Method read_raw_html has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def read_raw_html(src)
              extra_line = nil
              h = HTMLHelper.new
              begin
                l = src.shift_line
          Severity: Minor
          Found in lib/maruku/input/parse_block.rb - About 1 hr to fix

            Method describe_pos has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def describe_pos(buffer, buffer_index)
                  len = 75
                  num_before = [len/2, buffer_index].min
                  num_after = [len/2, buffer.size - buffer_index].min
                  num_before_max = buffer_index
            Severity: Minor
            Found in lib/maruku/input/charsource.rb - About 1 hr to fix

              Method read_ref_definition has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def read_ref_definition(src, out)
                  line = src.shift_line
              
                  # if link is incomplete, shift next line
                  if src.cur_line &&
              Severity: Minor
              Found in lib/maruku/input/parse_block.rb - About 1 hr to fix

                Method describe has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def describe
                      len = 75
                      num_before = [len/2, @scanner.pos].min
                      num_after = [len/2, @scanner.rest_size].min
                      num_before_max = @scanner.pos
                Severity: Minor
                Found in lib/maruku/input/charsource.rb - About 1 hr to fix

                  Method read_definition has a Cognitive Complexity of 9 (exceeds 5 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 55 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_entity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def to_latex_entity
                      entity_name = self.entity_name
                  
                      entity = MaRuKu::Out::EntityTable.instance.entity(entity_name)
                      unless entity
                  Severity: Minor
                  Found in lib/maruku/output/to_latex.rb - About 55 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 md_equation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def md_equation(math, label, numerate)
                        reglabel = /\\label\{(\w+)\}/
                        math = math.gsub(reglabel, '') if label = math[reglabel, 1]
                        num = nil
                        if (label || numerate) && @doc # take number
                  Severity: Minor
                  Found in lib/maruku/ext/math/elements.rb - About 55 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 create_toc has a Cognitive Complexity of 9 (exceeds 5 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 55 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 check_span_extensions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def check_span_extensions(src, con)
                      c = src.cur_char
                      if extensions = SpanExtensionsTrigger[c]
                        extensions.each do |e|
                          if e.regexp && src.next_matches(e.regexp)
                  Severity: Minor
                  Found in lib/maruku/input/extensions.rb - About 55 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_document_tree has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def to_html_document_tree
                      root = xelem('html')
                      root['xmlns'] = 'http://www.w3.org/1999/xhtml'
                      root['xmlns:svg'] = "http://www.w3.org/2000/svg"
                      root['xml:lang'] = self.attributes[:lang] || 'en'
                  Severity: Minor
                  Found in lib/maruku/output/to_html.rb - About 55 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

                  Avoid deeply nested control flow statements.
                  Open

                                              while not src.cur_line.t2_empty?
                                                  lines.push src.shift_line
                                              end
                  Severity: Major
                  Found in lib/maruku/input_textile2/t2_parser.rb - About 45 mins to fix

                    Method read_inline_code has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def read_inline_code(src, con)
                        # Count the number of ticks
                        num_ticks = 0
                        while src.cur_char == '`'
                          num_ticks += 1
                    Severity: Minor
                    Found in lib/maruku/input/parse_span.rb - About 45 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 read_text_material has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def read_text_material(src, output)
                        if src.cur_line.include?('|') && # if contains a pipe, it could be a table header
                            src.next_line &&
                            src.next_line.rstrip =~ TableSeparator
                          output << read_table(src)
                    Severity: Minor
                    Found in lib/maruku/input/parse_block.rb - About 45 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 count_columns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def count_columns(row)
                        colCount = 0
                    
                        row.each do |cell|
                          if cell.al && cell.al.size > 0
                    Severity: Minor
                    Found in lib/maruku/input/parse_block.rb - About 45 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 read_ref_definition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def read_ref_definition(src, out)
                        line = src.shift_line
                    
                        # if link is incomplete, shift next line
                        if src.cur_line &&
                    Severity: Minor
                    Found in lib/maruku/input/parse_block.rb - About 45 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