Showing 314 of 596 total issues
File graphql_query.rb
has 379 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Doi::GraphqlQuery
class Builder
include Modelable
DEFAULT_CURSOR = [0, ""]
Method index
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
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
File repository_type.rb
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class RepositoryType < BaseObject
description "Information about repositories"
field :uid,
ID,
null: false,
Method index
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
File repositories_controller.rb
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class RepositoriesController < ApplicationController
include ActionController::MimeResponds
include Countable
before_action :set_repository, only: %i[show update destroy]
File organization_type.rb
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class OrganizationType < BaseObject
MEMBER_ROLES = {
"ROLE_CONSORTIUM" => "consortium",
"ROLE_CONSORTIUM_ORGANIZATION" => "consortium_organization",
"ROLE_ALLOCATOR" => "direct_member",
File member_type.rb
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class MemberType < BaseObject
description "Information about members"
field :id,
ID,
Method organizations
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def organizations
authorize! :export, :organizations
begin
# Loop through all providers
Method index
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
Method index
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
Method schema_org
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
class EventsController < ApplicationController
include Identifiable
include Facetable
Method import_from_providers
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
Open
def index
sort =
case params[:sort]
when "relevance"
{ "_score" => { order: "desc" } }
Method index
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def index
sort =
case params[:sort]
when "name"
{ "prefix_id" => { order: "asc" } }
File old_events_controller.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class OldEventsController < ApplicationController
include ActionController::MimeResponds
include Identifiable
File exports_controller.rb
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
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
Open
def index
sort =
case params[:sort]
when "name"
{ "prefix.uid" => { order: "asc" } }