Showing 70 of 112 total issues
Method id_ancestor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def id_ancestor(node)
parent = nil
node.ancestors.each do |a|
(a["id"] && (parent = a) && @anchors.dig(a["id"], :xref)) or next
break
- 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 localize_maths
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def localize_maths(node, locale)
node.xpath(".//m:mn", MATHML).each do |x|
num = BigDecimal(x.text)
precision = /\./.match?(x.text) ? x.text.sub(/^.*\./, "").size : 0
x.children = localized_number(num, locale, precision)
- 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 admonition_parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def admonition_parse(node, out)
type = node["type"]
name = admonition_name(node, type)
out.div **admonition_attrs(node) do |t|
admonition_name_parse(node, t, name) if name
- 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 boilerplate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def boilerplate(node, out)
@bare and return
boilerplate = node.at(ns("//boilerplate")) or return
out.div class: "authority" do |s|
boilerplate.children.each do |n|
- 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 sequence_increment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sequence_increment(node)
if node["branch-number"]
@prefix_override = node["branch-number"]
elsif node["number"]
@base = @letter_override = @number_override = ""
- 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 print
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def print
@unnumbered and return nil
@prefix_override and return @prefix_override
num = @number_override || @num
out = @style == :roman && !num.nil? ? RomanNumerals.to_roman(num) : num
- 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 para_attrs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def para_attrs(node)
attrs = { class: para_class(node), id: node["id"], style: "" }
unless node["align"].nil?
attrs[:align] = node["align"] unless node["align"] == "justify"
attrs[:style] += "text-align:#{node['align']};"
- 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 agency1
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def agency1(xml)
agency = ""
publisher = []
xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = 'publisher']/" \
"organization")).each do |org|
- 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 header_strip_elem?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def header_strip_elem?(elem)
elem.name == "img" ||
(elem.name == "span" && elem["class"] == "MsoCommentReference") ||
(elem.name == "a" && elem["class"] == "FootnoteRef") ||
(elem.name == "span" && elem["style"]&.include?("mso-bookmark"))
- 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 ol_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ol_type(list, depth)
return list["type"].to_sym if list["type"]
return :arabic if [2, 7].include? depth
return :alphabet if [1, 6].include? depth
return :alphabet_upper if [4, 9].include? depth
- 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"