Showing 47 of 70 total issues
Class PlantumlRenderer
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class PlantumlRenderer
TEMPLATES_PATH = File.expand_path("../views/datamodel", __dir__).freeze
attr_reader :yml, :plantuml_path
File plantuml_renderer.rb
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "erb"
module Metanorma
module Datamodel
class PlantumlRenderer
Class TermLookupCleanup
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class TermLookupCleanup
AUTO_GEN_ID_REGEXP = /\A_/
attr_reader :xmldoc, :lookup, :log
Method cleanup
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cleanup(xmldoc)
@doctype = xmldoc.at("//bibdata/ext/doctype")&.text
element_name_cleanup(xmldoc)
passthrough_cleanup(xmldoc)
unnumbered_blocks_cleanup(xmldoc)
Method terms_subclause_type_tally
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def terms_subclause_type_tally(node, m, parent)
sym = if (node.at(".//term") && !node.at(".//definitions")) ||
(node.name == "terms" && !node.at(".//term"))
unless m[:parent] == :term # don't count Term > Term twice
:term
- 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 section
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def section(node)
a = section_attributes(node)
noko do |xml|
case sectiontype(node)
when "misc-container", "metanorma-extension"
- 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 section
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def section(node)
a = section_attributes(node)
noko do |xml|
case sectiontype(node)
when "misc-container", "metanorma-extension"
Method inline_quoted
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inline_quoted(node)
noko do |xml|
case node.type
when :emphasis then xml.em { |s| s << node.text }
when :strong then xml.strong { |s| s << node.text }
Method html_extract_attributes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def html_extract_attributes(node)
{
script: node.attr("script"),
bodyfont: node.attr("body-font"),
headerfont: node.attr("header-font"),
Method doc_extract_attributes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def doc_extract_attributes(node)
attrs = {
script: node.attr("script"),
bodyfont: node.attr("body-font"),
headerfont: node.attr("header-font"),
Method section_attributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def section_attributes(node)
ret =
{ id: Metanorma::Utils::anchor_or_uuid(node),
unnumbered: node.option?("unnumbered") ? "true" : nil,
annex: role_style(node, "appendix") && node.level == 1 ? true : nil,
- 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 dl_bib_extract
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dl_bib_extract(clause, nested = false)
dl = clause.at("./dl") or return
key = ""
bib = dl.xpath("./dt | ./dd").each_with_object({}) do |dtd, m|
(dtd.name == "dt" and key = dtd.text.sub(/:+$/, "")) and 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 uninterrupt_quotes_around_xml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def uninterrupt_quotes_around_xml(xmldoc)
xmldoc.traverse do |n|
next unless n.text? && n&.previous&.element?
next if uninterrupt_quotes_around_xml_skip(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 pop_floating_title
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def pop_floating_title(xmldoc)
loop do
found = false
xmldoc.xpath("//floating-title").each do |t|
t.next_element.nil? 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 maxcols_validate1
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def maxcols_validate1(tcell, row, curr, cells2d, maxcols, mode)
Method term_defs_boilerplate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def term_defs_boilerplate(div, source, term, _preface, isodoc)
Method norm_id_memorize_init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def norm_id_memorize_init(node, res_table, selector, prefix, use_domain)
Method merge_by_type
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def merge_by_type(old, new, field, attributes, opt = {})
Method table_tracker_update
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def table_tracker_update(cells2d, row, curr, rowspan, colspan)
Method output
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def output(isodoc_node, inname, outname, format, options = {})