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 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 to_html_document_tree
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_html_document_tree
root = xelem('html')
root['xmlns'] = 'http://www.w3.org/1999/xhtml'
root['xmlns:svg'] = "http://www.w3.org/2000/svg"
root['xml:lang'] = self.attributes[:lang] || 'en'
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 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 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 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 to_html_link
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_html_link
a = {}
id = self.ref_id || children_to_s
if ref = @doc.refs[sanitize_ref_id(id)] || @doc.refs[sanitize_ref_id(children_to_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"
Further reading
Method to_html_document_tree
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_html_document_tree
root = xelem('html')
root['xmlns'] = 'http://www.w3.org/1999/xhtml'
root['xmlns:svg'] = "http://www.w3.org/2000/svg"
root['xml:lang'] = self.attributes[:lang] || 'en'
- 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"