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)) }
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)
Class Node
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Node
def initialize(**params)
@params = params
end
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
- Read upRead up
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) }
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])
- Read upRead up
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[]
- Read upRead up
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 "'''"
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 = {}
- Read upRead up
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(/\[/)
- Read upRead up
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?
- Read upRead up
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 =
- Read upRead up
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)
- Read upRead up
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 =
- Read upRead up
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
- Read upRead up
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|
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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"