Showing 9 of 12 total issues
Class RfcEntry
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class RfcEntry
#
# Initalize parser
#
# @param [Nokogiri::XML::Element] doc document
Method to_xml
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
opts[:date_format] ||= :short
super(**opts) do |builder|
if opts[:bibdata] && (doctype || editorialgroup || ics&.any? ||
structuredidentifier&.presence? || stream)
- 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 update_versions
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def update_versions(versions) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
series = ""
bib_versions = []
Dir["#{@output}/*.#{@ext}"].each do |file|
match = /(?<series>draft-.+)-(?<ver>\d{2})\.#{@ext}$/.match file
- 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 full_name_org
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def full_name_org(name) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
case name
when "ISO"
RelatonBib::Organization.new(abbreviation: name, name: "International Organization for Standardization")
when "IAB"
Method render_authors
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def render_authors(builder) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
@bib.contributor.each do |c|
next if c.entity.is_a?(RelatonBib::Organization) && c.entity.name.map(&:content).include?("RFC Publisher")
builder.author do |xml|
- 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 opts[:bibdata] && (doctype || editorialgroup || ics&.any? ||
structuredidentifier&.presence? || stream)
ext = builder.ext do |b|
doctype&.to_xml b
b.subdoctype subdoctype if subdoctype
Method full_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def full_name(fname, sname, inits, lang, script = nil)
Method fetch_ieft_internet_drafts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fetch_ieft_internet_drafts # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
versions = Dir["bibxml-ids/*.xml"].each_with_object([]) do |path, vers|
file = File.basename path, ".xml"
if file.include?("D.draft-")
vers << file.sub(/^reference\.I-D\./, "").downcase
- 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 save_doc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_doc(entry, check_duplicate: true) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
return unless entry
c = case @format
when "xml" then entry.to_xml(bibdata: true)
- 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"