molybdenum-99/infoboxer

View on GitHub

Showing 18 of 53 total issues

File table_spec.rb has 458 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'infoboxer/parser'

module Infoboxer
  describe Parser, 'tables' do
    let(:ctx) { Parser::Context.new(unindent(source)) }
Severity: Minor
Found in spec/infoboxer/parser/table_spec.rb - About 7 hrs to fix

    Class Context has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Context # rubocop:disable Metrics/ClassLength
          attr_reader :lineno
          attr_reader :traits
    
          def initialize(text, traits = nil)
    Severity: Minor
    Found in lib/infoboxer/parser/context.rb - About 2 hrs to fix

      Class Node has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Node
            def initialize(**params)
              @params = params
            end
      
      
      Severity: Minor
      Found in lib/infoboxer/tree/node.rb - About 2 hrs to fix

        Method long_inline has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

              def long_inline(until_pattern = nil)
                nodes = Nodes[]
                guarded_loop do
                  chunk = @context.scan_until(re.inline_until_cache[until_pattern])
                  nodes << chunk
        Severity: Minor
        Found in lib/infoboxer/parser/inline.rb - About 2 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 inline_spec.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'infoboxer/parser'
        
        module Infoboxer
          describe Parser, 'inline markup' do
            let(:ctx) { Parser::Context.new(source) }
        Severity: Minor
        Found in spec/infoboxer/parser/inline_spec.rb - About 2 hrs to fix

          Method inline has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

                def inline(until_pattern = nil)
                  start = @context.lineno
                  nodes = Nodes[]
                  guarded_loop do
                    chunk = @context.scan_until(re.inline_until_cache[until_pattern])
          Severity: Minor
          Found in lib/infoboxer/parser/inline.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 template_vars has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                def template_vars
                  log 'Parsing template variables'
          
                  num = 1
                  res = Nodes[]
          Severity: Minor
          Found in lib/infoboxer/parser/template.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 inline_formatting has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def inline_formatting(match) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/AbcSize
                  case match
                  when "'''''"
                    BoldItalic.new(short_inline(/'''''/))
                  when "'''"
          Severity: Minor
          Found in lib/infoboxer/parser/inline.rb - About 1 hr to fix

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

                  def parse_params(str)
                    return {} unless str
            
                    scan = StringScanner.new(str)
                    params = {}
            Severity: Minor
            Found in lib/infoboxer/parser/util.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 scan_step has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                  def scan_step(scanner) # rubocop:disable Metrics/PerceivedComplexity
                    op = scanner.scan(%r{//?}) or unexpected(scanner, '/')
                    type = scanner.scan(/[A-Za-z_]*/)
                    attrs = {}
                    while scanner.scan(/\[/)
            Severity: Minor
            Found in lib/infoboxer/wiki_path.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 gallery has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                  def gallery(tag_rest)
                    params = parse_params(tag_rest)
                    images = []
                    guarded_loop do
                      @context.next! if @context.eol?
            Severity: Minor
            Found in lib/infoboxer/parser/inline.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 short_inline has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def short_inline(until_pattern = nil)
                    nodes = Nodes[]
                    guarded_loop do
                      # FIXME: quick and UGLY IS HELL JUST TRYING TO MAKE THE SHIT WORK
                      chunk =
            Severity: Minor
            Found in lib/infoboxer/parser/inline.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 << has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def <<(node) # rubocop:disable Metrics/PerceivedComplexity
                    if node.is_a?(Array)
                      node.each { |n| self << n }
                    elsif last&.can_merge?(node)
                      last.merge!(node)
            Severity: Minor
            Found in lib/infoboxer/tree/nodes.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 in_sections has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def in_sections
                      return parent.in_sections unless parent.is_a?(Tree::Document)
                      return @in_sections if @in_sections
            
                      heading =
            Severity: Minor
            Found in lib/infoboxer/navigation/sections.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 table_cells has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def table_cells(table, cell_class = TableCell)
                    log 'Table cells found'
                    table.push_children(TableRow.new) unless table.children.last.is_a?(TableRow)
                    row = table.children.last
            
            
            Severity: Minor
            Found in lib/infoboxer/parser/table.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 raw has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def raw(*titles, &processor)
                  # could emerge on "automatically" created page lists, should work
                  return {} if titles.empty?
            
                  titles.each_slice(50).map do |part|
            Severity: Minor
            Found in lib/infoboxer/media_wiki.rb - About 35 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 table_cell_cont has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def table_cell_cont(table)
                    container = case (last = table.children.last)
                                when TableRow
                                  last.children.last
                                when TableCaption
            Severity: Minor
            Found in lib/infoboxer/parser/table.rb - About 35 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 scan_continued_until has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def scan_continued_until(re, leave_pattern = false)
                    res = +''
            
                    loop do
                      chunk = _scan_until(re)
            Severity: Minor
            Found in lib/infoboxer/parser/context.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

            Severity
            Category
            Status
            Source
            Language