Showing 115 of 121 total issues
Method read_span
has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring. Open
def read_span(src, escaped, exit_on_chars=nil, exit_on_strings=nil)
escaped = Array(escaped)
con = SpanContext.new
dquote_state = squote_state = :closed
c = d = prev_char = nil
- 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 parse_span.rb
has 596 lines of code (exceeds 250 allowed). Consider refactoring. Open
module MaRuKu::In::Markdown::SpanLevelParser
include MaRuKu::Helpers
EscapedCharInText = '\\`*_{}[]()#.!|:+->'.split(//)
EscapedCharInQuotes = EscapedCharInText + ["'", '"']
File to_html.rb
has 576 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'maruku/string_utils'
require 'cgi'
# This module groups all functions related to HTML export.
module MaRuKu::Out::HTML
Method read_span
has 244 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_span(src, escaped, exit_on_chars=nil, exit_on_strings=nil)
escaped = Array(escaped)
con = SpanContext.new
dquote_state = squote_state = :closed
c = d = prev_char = nil
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 eat_this
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def eat_this(line)
@rest = line + @rest
things_read = 0
until @rest.empty?
case self.state
- 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
File to_latex.rb
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'set'
require 'maruku/output/entity_table'
module MaRuKu::Out::Latex
module MDDocumentExtensions
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 read_attribute_list
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def read_attribute_list(src, con=nil, break_on_chars=nil)
break_on_chars = Array(break_on_chars)
separators = break_on_chars + ['=', ' ', "\t"]
escaped = Maruku::EscapedCharInQuotes
- 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 to_s5
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s5(context={})
content_only = context[:content_only] != false
print_slides = context[:print_slides]
if content_only
Method convert_to_png_blahtex
has a Cognitive Complexity of 24 (exceeds 5 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: ")
- 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 array_to_html
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def array_to_html(array)
e = []
array.each do |c|
if c.kind_of?(String)
e << xtext(c)
- 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 search_abbreviations
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def search_abbreviations
abbreviations.each do |abbrev, title|
reg = Regexp.new(Regexp.escape(abbrev))
replace_each_string do |s|
# bug if many abbreviations are present (agorf)
- 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 t2_parse_blocks
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def t2_parse_blocks(src, output)
while src.cur_line
l = src.shift_line
# ignore empty 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 eat_this
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eat_this(line)
@rest = line + @rest
things_read = 0
until @rest.empty?
case self.state
Method expand_attribute_list
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def expand_attribute_list(al, result)
al.each do |k, v|
case k
when :class
if result[:class]
- 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 process_markdown_inside_elements
has a Cognitive Complexity of 22 (exceeds 5 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
- 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"