Showing 65 of 82 total issues
Method document
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def document(node)
$seen_back_matter = false
$smart_quotes = (node.attr("smart-quotes") != "false")
$inline_definition_lists = (node.attr("inline-definition-lists") == "true")
Method series_info
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def series_info(node, xml)
docname = node.attr("name")
return if docname.nil? || docname&.empty?
is_rfc = docname =~ /^rfc-?/i || node.attr("doctype") == "rfc"
Method inline_quoted
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def inline_quoted(node)
noko do |xml|
case node.type
when :emphasis
xml.spanx node.text, style: "emph"
- 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_biblio
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_biblio(node, xmldoc)
# we want no references in this document, so we can ignore any anchors of references
xmldoc.xpath("//referencegroup | //reference").each(&:remove)
refs = Set.new
xmldoc.xpath("//xref | //relref").each { |r| refs << r["target"] }
Method section
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def section(node)
result = []
if node.attr("style") == "bibliography" ||
node.parent.context == :section && node.parent.attr("style") == "bibliography"
$xreftext = {}
Method inline_anchor_xref
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inline_anchor_xref(node)
if node.text =~ /^\S+ (of|comma|parens|bare)\b/
# <<crossreference#fragment,section (of|comma|parens|bare): text>> = relref:
# render equivalent in v2
matched = /(?<section>\S+)\s+(?<format>[a-z]+)(: )?(?<text>.*)$/.match node.text
Method document
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def document(node)
$seen_back_matter = false
# If this is present, then BCP14 keywords in boldface are not assumed to be <bcp14> tags. By default they are.
$bcp_bold = !(node.attr? "no-rfc-bold-bcp14")
$smart_quotes = (node.attr("smart-quotes") != "false")
- 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 cleanup
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def cleanup(doc)
xmldoc = Nokogiri::XML(doc) do |config|
config.noent
end
- 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 common_rfc_pis
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def common_rfc_pis(node)
# Below are generally applicable Processing Instructions (PIs)
# that most I-Ds might want to use, common to v2 and v3.
# These are set only if explicitly specified, with the exception
# of compact and subcompact
Method admonition
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def admonition(node)
result = []
if node.parent.context == :preamble
note_attributes = {
# default title provided: title is mandatory
Method cache_biblio
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cache_biblio(node)
bibliocache_name = "#{Dir.home}/.asciidoc-rfc-biblio-cache.json"
# If we are required to, clear the biblio cache
if node.attr("flush-caches") == "true"
FileUtils.rm_f bibliocache_name
Method flatten_rawtext
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def flatten_rawtext(node)
result = []
if node.respond_to?(:blocks) && node.blocks?
node.blocks.each { |b| result << flatten_rawtext(b) }
elsif node.respond_to?(:lines)
- 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 olist
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def olist(node)
result = []
result << noko do |xml|
type = OLIST_TYPES[node.style.to_sym]
- 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
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def admonition(node)
result = []
if node.parent.context == :preamble
note_attributes = {
removeInRFC: node.attr("remove-in-rfc"),
- 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 ref_section
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ref_section(node)
result = []
$processing_reflist = true
references_attributes = {
anchor: node.id,
Method table
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def table(node)
has_body = false
has_head = false
style_value = case node.attr "grid"
when "all"
Method dlist
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dlist(node)
result = []
result << noko do |xml|
dl_attributes = {
Method merge_vspace
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge_vspace(node)
nodes = []
newnodes = []
node.children.each do |element|
nodes << element
Method cache_workgroup
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cache_workgroup(node)
wgcache_name = "#{Dir.home}/.asciidoc-rfc-workgroup-cache.json"
# If we are required to, clear the wg cache
if node.attr("flush-caches") == "true"
FileUtils.rm_f wgcache_name
Method table
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def table(node)
noko do |xml|
has_body = false
# TODO iref belongs here
- 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"