Method docids
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def docids(reference, ver) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
ret = []
si = reference.at("./seriesInfo[@name='Internet-Draft']",
"./front/seriesInfo[@name='Internet-Draft']")
if si
- 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
File bibxml_parser.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RelatonBib
module BibXMLParser
# SeriesInfo what should be saved as docidentifiers in the Relaton model.
SERIESINFONAMES = ["DOI"].freeze
RFCPREFIXES = %w[RFC BCP FYI STD].freeze
Method docids
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def docids(reference, ver) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
ret = []
si = reference.at("./seriesInfo[@name='Internet-Draft']",
"./front/seriesInfo[@name='Internet-Draft']")
if si
Method create_docid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_docid(id, ver) # rubocop:disable Metrics/MethodLength
pref, num = id_to_pref_num(id)
if RFCPREFIXES.include?(pref)
pid = "#{pref} #{num.sub(/^-?0+/, '')}"
type = pubid_type id
- 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 link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def link(reference, url, ver)
l = []
l << { type: "xml", content: url } if url
l << { type: "src", content: reference[:target] } if reference[:target]
if /^I-D/.match? reference[:anchor]
- 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"