Showing 10 of 10 total issues
Method params
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def params # rubocop:disable Metrics/MethodLength
input = @refid.dup
input.year = nil
{
"Input" => input.to_s,
Method parse_page
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_page(hit, imp: false) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
doc = get_page hit
return unless doc.code == "200"
if imp
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(bureau:, group:, subgroup: nil, workgroup: nil)
unless BUREAUS.include? bureau
Util.warn "WARNING: Invalid bureau: `#{bureau}`"
Util.warn "WARNING: Valid bureaus are: `#{BUREAUS.join('`, `')}`"
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 roman_to_2digit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def roman_to_2digit(num) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
return unless num
roman_nums = { "I" => 1, "V" => 5, "X" => 10 }
last = roman_nums[num[-1]]
- 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 to_h
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_h(with_type: true) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
hash = { prefix: prefix, sector: sector, code: code }
hash[:type] = type if type && with_type
hash[:suppl] = suppl if suppl
hash[:annex] = annex if annex
- 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 fetch_abstract
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fetch_abstract(doc, hit) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
abstract_url = doc.at '//table/tr[td/span[.="In force"]]/td/span[contains(@id, "lbl_dms")]/div'
content = if abstract_url
url = abstract_url[:onclick].match(/https?[^']+/).to_s
rsp = hit.hit_collection.agent.get url
- 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 get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get(code, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
refid = Pubid.parse code
refid.year ||= year
# if year.nil?
# /^(?<code1>[^\s]+\s[^\s]+)\s\((?:\d{2}\/)?(?<year1>\d+)\)$/ =~ code
- 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 isobib_results_filter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def isobib_results_filter(result, refid)
missed_years = []
result.each do |r|
/\((?:\d{2}\/)?(?<pyear>\d{4})\)/ =~ r.hit[:code]
if !refid.year || refid.year == pyear
- 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 to_xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(builder) # rubocop:disable Metrics/AbcSize
builder.editorialgroup do
builder.bureau bureau
builder.group { |b| group.to_xml b } if group
builder.subgroup { |b| group.to_xml b } if subgroup
- 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 parse_page
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_page(hit, imp: false) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
doc = get_page hit
return unless doc.code == "200"
if imp
- 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"