Showing 575 of 596 total issues
Method schema_org
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
def schema_org
hsh = {
"@context" => "http://schema.org",
"@type" => object.types.present? ? object.types["schemaOrg"] : nil,
"@id" => normalize_doi(object.doi),
File events_controller.rb
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
class EventsController < ApplicationController
include Identifiable
include Facetable
Method import_from_providers
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.import_from_providers
Provider.all.find_each do |provider|
if provider.voting_contact_email
contact = Contact.where(email: provider.voting_contact_email).first_or_create
if contact.update(
Method index
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort =
case params[:sort]
when "name"
{ "prefix_id" => { order: "asc", unmapped_type: "keyword" } }
Method index
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort =
case params[:sort]
when "name"
{ "prefix_id" => { order: "asc" } }
Method index
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
File old_events_controller.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
class OldEventsController < ApplicationController
include ActionController::MimeResponds
include Identifiable
File exports_controller.rb
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ExportsController < ApplicationController
include ActionController::MimeResponds
before_action :authenticate_user_with_basic_auth!
Method as_indexed_json
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def as_indexed_json(_options = {})
{
"id" => uid,
"uid" => uid,
"doi" => doi,
Method index
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort =
case params[:sort]
when "name"
{ "prefix.uid" => { order: "asc" } }
File clients_controller.rb
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ClientsController < ApplicationController
include Countable
before_action :set_client, only: %i[show update destroy]
before_action :authenticate_user!
Method safe_params
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def safe_params
if params[:data].blank?
fail JSON::ParserError,
"You need to provide a payload following the JSONAPI spec"
end
Method index
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
Method perform
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def perform(id, _options = {})
item = Event.where(uuid: id).first
return false if item.blank?
case item.source_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 perform
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def perform(doi_id)
doi = Doi.where(doi: doi_id).first
if doi.present?
response = Doi.get_doi(doi: doi.doi, agency: doi.agency)
- 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 index
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
- 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 index
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
- 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 reset
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.reset(username)
uid = username.downcase
if uid.include?(".")
user = Client.where(symbol: uid.upcase).where(deleted_at: nil).first
File helpable.rb
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Helpable
extend ActiveSupport::Concern
require "bolognese"
require "csv"
Method get_doi_ra
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def get_doi_ra(doi, options = {})
return {} if doi.blank?
options[:timeout] ||= 120
doi = CGI.unescape(clean_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"