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
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
- 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 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
- 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 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
- 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 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
Method read_table
has 66 lines of code (exceeds 25 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
Method read_raw_html
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def read_raw_html(src)
extra_line = nil
h = HTMLHelper.new
begin
l = src.shift_line
- 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 read_xml_instruction
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def read_xml_instruction(src, output)
m = /^\s*<\?((\w+)\s*)?(.*)$/.match src.shift_line
raise "BugBug" unless m
target = m[2] || ''
code = m[3]
- 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 read_indented_content
has 46 lines of code (exceeds 25 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
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|
- 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 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
- 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 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))
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
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 &&
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))
- 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 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 &&
- 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 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)
- 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 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
- 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 read_indented_content
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def read_indented_content(src, indentation, break_list, item_type, ial_offset=0)
Method split_cells
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def split_cells(s, allowBlank = false)
if allowBlank
if /^[|].*[|]$/ =~ s # handle the simple and decorated table cases
s.split('|', -1)[1..-2] # allow blank cells, but only keep the inner elements of the cells
elsif /^.*[|]$/ =~ s
- 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"