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 array_to_latex
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def array_to_latex(array, join_char='')
e = []
array.each do |c|
if c.kind_of?(String)
e << string_to_latex(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_latex_entity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_latex_entity
entity_name = self.entity_name
entity = MaRuKu::Out::EntityTable.instance.entity(entity_name)
unless entity
- 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_latex_code
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_latex_code
if get_setting(:latex_use_listings)
@doc.latex_require_package('listings')
s = "\\lstset{columns=fixed,frame=shadowbox}"
- 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 latex_color
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def latex_color(s, command='color')
if s =~ /\A\#([1-9A-F]{1,2})([1-9A-F]{1,2})([1-9A-F]{1,2})\z/i
# convert from 0-255 or 0-15 to 0.0-1.0
r, g, b = [$1, $2, $3].map {|c| c.hex / (c.length == 1 ? 15.0 : 255.0) }
"\\#{command}[rgb]{%0.2f,%0.2f,%0.2f}" % [r, g, b]
- 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_latex_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_latex_link
id = self.ref_id || children_to_s
ref = @doc.refs[sanitize_ref_id(id)] || @doc.refs[sanitize_ref_id(children_to_s)]
if ref
url = ref[:url]
- 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_latex_header
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_latex_header
header_levels = %w(section subsection subsubsection)
h = header_levels[self.level - 1] || 'paragraph'
title = children_to_latex
- 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"