Showing 12 of 14 total issues
Method import_record
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def self.import_record(doc)
iss_itemno = URI.parse(doc.at('//dcndl:BibAdminResource[@rdf:about]').values.first).path.split('/').last
ndl_bib_id = NdlBibIdRecord.find_by(body: iss_itemno.split('-')[1].gsub(/^I/, ''))
return ndl_bib_id.manifestation if ndl_bib_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 create_additional_attributes
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def self.create_additional_attributes(doc, manifestation)
title = get_title(doc)
creators = get_creators(doc).uniq
subjects = get_subjects(doc).uniq
classifications = get_classifications(doc).uniq
- 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 import_record
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.import_record(doc)
iss_itemno = URI.parse(doc.at('//dcndl:BibAdminResource[@rdf:about]').values.first).path.split('/').last
ndl_bib_id = NdlBibIdRecord.find_by(body: iss_itemno.split('-')[1].gsub(/^I/, ''))
return ndl_bib_id.manifestation if ndl_bib_id
File enju_manifestation.rb
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
module EnjuNdl
module EnjuManifestation
extend ActiveSupport::Concern
included do
Method create_additional_attributes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_additional_attributes(doc, manifestation)
title = get_title(doc)
creators = get_creators(doc).uniq
subjects = get_subjects(doc).uniq
classifications = get_classifications(doc).uniq
Method search_crd
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.search_crd(options)
params = { page: 1 }.merge(options)
crd_page = params[:page].to_i
crd_page = 1 if crd_page <= 0
crd_startrecord = (crd_page - 1) * Question.crd_per_page + 1
Method create_series_statement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.create_series_statement(doc, manifestation)
series = series_title = {}
series[:title] = doc.at('//dcndl:seriesTitle/rdf:Description/rdf:value').try(:content)
series[:title_transcription] = doc.at('//dcndl:seriesTitle/rdf:Description/dcndl:transcription').try(:content)
series[:creator] = doc.at('//dcndl:seriesCreator').try(:content)
- 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 search_crd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.search_crd(options)
params = { page: 1 }.merge(options)
crd_page = params[:page].to_i
crd_page = 1 if crd_page <= 0
crd_startrecord = (crd_page - 1) * Question.crd_per_page + 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 get_extent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.get_extent(doc)
extent = doc.at('//dcterms:extent').try(:content)
value = { start_page: nil, end_page: nil, height: nil }
if extent
extent = extent.split(';')
- 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 import_from_ndl_search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.import_from_ndl_search(options)
# if options[:isbn]
lisbn = Lisbn.new(options[:isbn])
raise EnjuNdl::InvalidIsbn unless lisbn.valid?
# 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 link_to_import_from_ndl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def link_to_import_from_ndl(iss_itemno)
if iss_itemno.blank?
t('enju_ndl.not_available')
else
identifier_type = IdentifierType.where(name: 'iss_itemno').first
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
if params[:book]
begin
@manifestation = NdlBook.import_from_sru_response(params[:book].try(:[], 'iss_itemno'))
rescue EnjuNdl::RecordNotFound
- 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"