Showing 65 of 369 total issues
Method push_item
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.push_item(item)
attributes = item.fetch("attributes", {})
doi = attributes.fetch("doi", nil)
return nil if doi.blank?
File crossref_import.rb
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
class CrossrefImport < Base
LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/".freeze
def self.import_by_month(options = {})
from_date = (options[:from_date].present? ? Date.parse(options[:from_date]) : Date.current).beginning_of_month
Method push_related_items
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.push_related_items(item:, pid:)
related_doi_identifiers = Array.wrap(item.fetch("reference",
nil)).select do |r|
r["DOI"].present?
end
Method push_item
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.push_item(item)
attributes = item.fetch("attributes", {})
doi = attributes.fetch("doi", nil)
return nil if doi.blank?
- 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 push_item
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.push_item(item)
doi = item.fetch("DOI", nil)
return nil if doi.blank?
pid = normalize_doi(doi)
Method parse_record
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_record(sqs_msg: nil, data: nil)
id = "https://doi.org/#{data['id']}"
response = get_datacite_json(id)
related_identifiers = Array.wrap(response.fetch("relatedIdentifiers",
nil)).select do |r|
- 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 push_item
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.push_item(item)
subj = cached_crossref_response(item["subj_id"])
obj = cached_datacite_response(item["obj_id"])
if ENV["STAFF_ADMIN_TOKEN"].present?
Method normalize_pmid
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def normalize_pmid(id)
return nil if id.blank?
id = id.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 push_related_items
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.push_related_items(item:, pid:)
related_doi_identifiers = Array.wrap(item.fetch("reference",
nil)).select do |r|
r["DOI"].present?
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 normalize_igsn
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def normalize_igsn(id)
return nil if id.blank?
id = id.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 queue_jobs
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:offset] = options[:offset].to_i || 0
options[:rows] = options[:rows].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
Method queue_jobs
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:number] = options[:number].to_i || 1
options[:size] = options[:size].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
Method queue_jobs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:rows] = options[:rows].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
options[:until_date] =
Method queue_jobs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:rows] = options[:rows].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
options[:until_date] =
Method queue_jobs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:rows] = options[:rows].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
options[:until_date] =
Method queue_jobs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:rows] = options[:rows].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
options[:until_date] =
Method get_orcid_metadata
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_orcid_metadata(id)
# use metadata stored with DataCite if they exist
response = get_researcher_metadata(id)
return response if response.present?
Method queue_jobs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:rows] = options[:rows].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
options[:until_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"
Further reading
Method queue_jobs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def queue_jobs(options = {})
options[:number] = options[:number].to_i || 1
options[:size] = options[:size].presence || job_batch_size
options[:from_date] =
options[:from_date].presence || (Time.now.to_date - 1.day).iso8601
- 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 push_item
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.push_item(item)
doi = item.fetch("DOI", nil)
return nil if doi.blank?
pid = normalize_doi(doi)
- 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"