Showing 61 of 88 total issues
Method png_validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def png_validate(doc)
doc.xpath("//image[@mimetype = 'image/png']").each do |i|
Vectory::Utils::url?(i["src"]) and next
decoded = if Vectory::Utils::datauri?(i["src"])
Vectory::Utils::decode_datauri(i["src"])[: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 admonition_core_attrs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def admonition_core_attrs(node)
{ notag: node.attr("notag") == "true" ? "true" : nil,
coverpage: node.attr("coverpage") == "true" ? "true" : nil,
beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil,
unnumbered: node.attr("unnumbered") ||
- 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 hanging_para_style
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hanging_para_style(root)
root.xpath("//clause | //annex | //foreword | //introduction | " \
"//acknowledgements").each do |c|
next unless c.at("./clause")
next if c.elements.reject 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 move_attrs_to_amend
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def move_attrs_to_amend(clause, amend)
%w(change path path_end title).each do |e|
next unless clause[e]
amend[e] = clause[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
Avoid too many return
statements within this method. Open
return symbols_parse(attrs, xml, node)
Avoid too many return
statements within this method. Open
return clause_parse(attrs, xml, node)
Avoid too many return
statements within this method. Open
svg = File.read(path, encoding: "utf-8") or return false
Method figure_footnote_cleanup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def figure_footnote_cleanup(xmldoc)
nomatches = false
until nomatches
nomatches = true
xmldoc.xpath(FIGURE_FN_XPATH).each do |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 math_validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def math_validate(doc)
doc.xpath("//m:math", "m" => MATHML_NS).each do |m|
if m.parent["validate"] == "false"
m.parent.delete("validate")
else
- 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 alternate_termdefinitions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def alternate_termdefinitions(xmldoc)
xmldoc.xpath("//term").each do |t|
t.xpath("./definition").each do |d|
d1 = d.next_element or next
if (v = d.at("./verbal-definition")) &&
- 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 redundant_bookmark_cleanup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def redundant_bookmark_cleanup(xmldoc)
xmldoc.xpath("//bookmark").each do |b|
p = b
while !p.xml? && p = p.parent
p["id"] == b["id"] or next
- 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 supply_br
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def supply_br(lines)
ignore = false
lines.each_with_index do |l, i|
/^(--+|====+|\|===|\.\.\.\.+|\*\*\*\*+|\+\+\+\++|````+|____\+)$/
.match(l) and (ignore = !ignore)
- 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 refitem1code
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def refitem1code(_item, match)
code = analyse_ref_code(match[:code])
((code[:id] && code[:numeric]) || code[:nofetch]) and
return { code: nil, match: match, analyse_code: code,
hidden: code[:hidden] }
- 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 mi_italicise?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mi_italicise?(char)
char.length > 1 and return false
case char
when /\p{Greek}/
(/\p{Lower}/.match(char) && !mathml_mi_italics[:lowergreek]) ||
- 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 span_preprocess1
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def span_preprocess1(span, ret)
case span[:key]
when "uri", "docid"
val = link_unwrap(Nokogiri::XML.fragment(span[:val])).to_xml
ret[span[:key].to_sym] << { type: span[:type], val: val }
- 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 references2xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def references2xml(ret)
out = ret.map do |b|
b.nil? ? nil : noko { |xml| reference1out(b, xml) }.join
end
out.map { |x| x.nil? ? nil : Nokogiri::XML(x).root }
- 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 which
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.which(cmd)
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
exts.each do |ext|
exe = File.join(path, "#{cmd}#{ext}")
- 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 empty_element_cleanup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def empty_element_cleanup(xmldoc)
xmldoc.xpath("//#{TEXT_ELEMS.join(' | //')}").each do |x|
next if x.name == "name" && x.parent.name == "expression"
x.remove if x.children.empty?
- 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 variant_cleanup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def variant_cleanup(xmldoc)
variant_space_cleanup(xmldoc)
xmldoc.xpath("//*[variant]").each do |c|
next unless c.children.any? do |n|
n.name != "variant" && (!n.text? || !n.text.gsub(/\s/, "").empty?)
- 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 analyse_ref_repo_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def analyse_ref_repo_path(ret)
m = /^(?<type>repo|path|attachment):\((?<key>[^,]+),?(?<id>[^)]*)\)$/
.match(ret[:id]) or return ret
id = if m[:id].empty?
if m[:type] == "attachment"
- 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"