Method render_address
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def render_address(builder, contrib) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
address, contact = address_contact contrib.entity.contact
if address || contact.any?
builder.address do |xml|
# address = contrib.entity.contact.detect { |cn| cn.is_a? Address }
- 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 render_bibxml_ref
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def render_bibxml_ref(builder, include_keywords) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
builder.reference(**ref_attrs) do |xml|
if @bib.title.any? || @bib.contributor.any? || @bib.date.any? || @bib.abstract.any? ||
@bib.editorialgroup&.technical_committee&.any? ||
(include_keywords && @bib.keyword.any?)
- 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
Consider simplifying this complex logical expression. Open
if @bib.title.any? || @bib.contributor.any? || @bib.date.any? || @bib.abstract.any? ||
@bib.editorialgroup&.technical_committee&.any? ||
(include_keywords && @bib.keyword.any?)
xml.front do
xml.title @bib.title[0].title.content if @bib.title.any?
Method render_person
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def render_person(builder, person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
render_organization builder, person.affiliation.first&.organization
if person.name.completename
builder.parent[:fullname] = person.name.completename.content
elsif person.name.forename.any?
- 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_attrs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ref_attrs # rubocop:disable Metrics/AbcSize
discopes = %w[anchor docName number]
attrs = @bib.docidentifier.each_with_object({}) do |di, h|
next unless discopes.include?(di.scope)
- 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 render_authors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_authors(builder) # rubocop:disable Metrics/AbcSize
@bib.contributor.each do |c|
builder.author do |xml|
xml.parent[:role] = "editor" if c.role.detect { |r| r.type == "editor" }
if c.entity.is_a?(Person) then render_person xml, c.entity
- 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 render_date
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render_date(builder) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
dt = @bib.date.detect { |d| d.type == "published" }
return unless dt
elm = builder.date
- 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"