Showing 121 of 121 total issues
Method to_html_code
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_html_code
source = self.raw_code
code_lang = self.lang || self.attributes[:lang] || @doc.attributes[:code_lang]
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 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 parse_doc
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_doc(s)
# Remove BOM if it is present
s = s.sub(/^\xEF\xBB\xBF/u, '')
meta2 = parse_email_headers(s)
data = meta2.delete :data
Method convert_to_mathml_itex2mml
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def convert_to_mathml_itex2mml(kind, tex)
return if $already_warned_itex2mml
begin
require 'itextomml'
rescue LoadError => e
- 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 render_footnotes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def render_footnotes
div = xelem('div')
div['class'] = 'footnotes'
div << xelem('hr')
ol = xelem('ol')
- 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 convert_to_png_blahtex
has 38 lines of code (exceeds 25 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: ")
Method to_html_code
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def to_html_code
source = self.raw_code
code_lang = self.lang || self.attributes[:lang] || @doc.attributes[:code_lang]
- 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 to_s5
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def to_s5(context={})
content_only = context[:content_only] != false
print_slides = context[:print_slides]
if content_only
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_markdown_inside_elements(doc)
elts = []
@fragment.each_element('//*[@markdown]') do |e|
elts << e
end
Method expand_attribute_list
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expand_attribute_list(al, result)
al.each do |k, v|
case k
when :class
if result[:class]
Method handle_tag
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_tag
@already << @m.pre_match
@rest = @m.post_match
is_closing = !!@m[1]
Method method_missing
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def method_missing(methodname, *args)
a_bef = @a.describe
b_bef = @b.describe
a = @a.send(methodname, *args)
Method parse_doc
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_doc(s)
# Remove BOM if it is present
s = s.sub(/^\xEF\xBB\xBF/u, '')
meta2 = parse_email_headers(s)
data = meta2.delete :data
- 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 merge_ial
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def merge_ial(elements, src, con)
# Apply each IAL to the element before
(elements + [nil]).each_cons(3) do |before, e, after|
next unless ial?(e)
- 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 render_footnotes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_footnotes
div = xelem('div')
div['class'] = 'footnotes'
div << xelem('hr')
ol = xelem('ol')
Method create_toc
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_toc
self.header_ids = Hash.new(0)
each_element(:header) {|h| h.attributes[:id] ||= h.generate_id }
Method read_simple
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_simple(src, escaped, exit_on_chars=nil, exit_on_strings=nil, warn=true)
text = ""
escaped = Array(escaped)
exit_on_chars = Array(exit_on_chars)
exit_on_strings = Array(exit_on_strings)
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 wrap
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wrap(array, line_length, context)
out = ""
line = ""
array.each do |c|
if c.kind_of?(MaRuKu::MDElement) && c.node_type == :linebreak