Showing 70 of 112 total issues
Method make_tr_attr_style
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def make_tr_attr_style(cell, row, rowmax, totalrows, opt)
top = row.zero? ? "#{SW1} 1.5pt;" : "none;"
bottom = "#{SW1} #{rowmax >= totalrows ? '1.5' : '1.0'}pt;"
ret = <<~STYLE.gsub(/\n/, "")
border-top:#{top}mso-border-top-alt:#{top}
- 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 figure_parse1
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def figure_parse1(node, out)
out.div **figure_attrs(node) do |div|
node.children.each do |n|
figure_key(out) if n.name == "dl"
parse(n, div) unless n.name == "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 trim_hash1
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def trim_hash1(hash)
hash.is_a?(Hash) or return hash
hash.each_with_object({}) do |(k, v), g|
blank?(v) and next
g[k] = case v
- 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 case_with_markup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def case_with_markup(linkend, casing, script, firstonly: true)
seen = false
xml = Nokogiri::XML("<root>#{linkend}</root>")
xml.traverse do |b|
next unless b.text? && !seen
- 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_parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def para_parse(node, out)
out.p **attr_code(para_attrs(node)) do |p|
unless @termdomain.empty?
p << "<#{@termdomain}> "
@termdomain = ""
- 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 passthrough_xslt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def passthrough_xslt
@output_formats.nil? and return nil
@output_formats.empty? and return nil
@output_formats.each_key.with_object([]) do |k, m|
m << <<~XSLT
- 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 list_item_anchor_names
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
list.xpath(ns("./li")).each do |li|
bare_label, label =
list_item_value(li, c, depth, { list_anchor: list_anchor, prev_label: prev_label,
- 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
n = node["class"] and return n
Avoid too many return
statements within this method. Open
return anchor_linkend1(node) || "???"
Avoid too many return
statements within this method. Open
return :roman_upper if [5, 10].include? depth
Avoid too many return
statements within this method. Open
return :roman if [3, 8].include? depth
Method localpath
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def localpath(path)
return path if %r{^[A-Z]:|^/|^file:/}.match?(path)
return path unless (@sourcedir || @localdir) && path
File.expand_path(File.join((@sourcedir || @localdir), path))
- 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 docstatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def docstatus(xml, _out)
set(:unpublished, true)
return unless s = xml.at(ns("//bibdata/status/stage#{NOLANG}"))
s1 = xml.at(ns("//bibdata/status/stage#{currlang}")) || 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 insert_comment_cont
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def insert_comment_cont(from, upto, target)
# includes_to = from.at(".//*[@id='#{upto}']")
while !from.nil? && from["id"] != upto
following = from.xpath("./following::*")
(from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
- 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 external_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def external_path(path)
win = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) ||
(RUBY_PLATFORM =~ /mswin|mingw/))
if win
path.gsub!(%{/}, "\\")
- 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 anchor_struct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def anchor_struct(lbl, container, elem, type, unnumb = false)
ret = {}
ret[:label] = unnumb == "true" ? nil : anchor_struct_label(lbl, elem)
ret[:xref] = anchor_struct_xref(unnumb == "true" ? "(??)" : lbl, elem)
ret[:xref].gsub!(/ $/, "")
- 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 i8n_name1
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def i8n_name1(hash, pref)
hash.reject { |_k, v| blank?(v) }.each_with_object([]) do |(k, v), g|
case v
when Hash then i8n_name(v, i18n_safe(k)).each { |x| g << x }
when Array
- 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 insert_comment_cont
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def insert_comment_cont(from, upto, target)
# includes_to = from.at(".//*[@id='#{upto}']")
while !from.nil? && from["id"] != upto
following = from.xpath("./following::*")
(from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
- 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 example_table_parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def example_table_parse(node, out)
out.table **example_table_attr(node) do |t|
t.tr do |tr|
tr.td **EXAMPLE_TBL_ATTR do |td|
example_label(node, td, node.at(ns("./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 case_strict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def case_strict(text, casing, script, firstonly: true)
return text unless %w(Latn Cyrl Grek Armn).include?(script)
seen = false
text.split(/(\s+)/).map do |w|
- 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"