datacite/lupo

View on GitHub

Showing 314 of 596 total issues

File graphql_query.rb has 379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Doi::GraphqlQuery
  class Builder
    include Modelable

    DEFAULT_CURSOR = [0, ""]
Severity: Minor
Found in app/models/doi/graphql_query.rb - About 5 hrs to fix

    Method index has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        sort =
          case params[:sort]
          when "relevance"
            { "_score" => { order: "desc" } }
    Severity: Minor
    Found in app/controllers/activities_controller.rb - About 5 hrs to fix

    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

    class RepositoryType < BaseObject
      description "Information about repositories"
      field :uid,
            ID,
            null: false,
    Severity: Minor
    Found in app/graphql/types/repository_type.rb - About 5 hrs to fix

      Method index has 117 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def index
          sort =
            case params[:sort]
            when "relevance"
              { "_score" => { order: "desc" } }
      Severity: Major
      Found in app/controllers/activities_controller.rb - About 4 hrs to fix

        File repositories_controller.rb has 360 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class RepositoriesController < ApplicationController
          include ActionController::MimeResponds
          include Countable
        
          before_action :set_repository, only: %i[show update destroy]
        Severity: Minor
        Found in app/controllers/repositories_controller.rb - About 4 hrs to fix

          File organization_type.rb has 354 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class OrganizationType < BaseObject
            MEMBER_ROLES = {
              "ROLE_CONSORTIUM" => "consortium",
              "ROLE_CONSORTIUM_ORGANIZATION" => "consortium_organization",
              "ROLE_ALLOCATOR" => "direct_member",
          Severity: Minor
          Found in app/graphql/types/organization_type.rb - About 4 hrs to fix

            File member_type.rb has 353 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class MemberType < BaseObject
              description "Information about members"
            
              field :id,
                    ID,
            Severity: Minor
            Found in app/graphql/types/member_type.rb - About 4 hrs to fix

              Method organizations has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def organizations
                  authorize! :export, :organizations
              
                  begin
                    # Loop through all providers
              Severity: Major
              Found in app/controllers/exports_controller.rb - About 4 hrs to fix

                Method index has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def index
                    sort =
                      case params[:sort]
                      when "relevance"
                        { "_score" => { order: "desc" } }
                Severity: Major
                Found in app/controllers/members_controller.rb - About 4 hrs to fix

                  Method index has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def index
                      sort =
                        case params[:sort]
                        when "relevance"
                          { "_score" => { order: "desc" } }
                  Severity: Major
                  Found in app/controllers/prefixes_controller.rb - About 4 hrs to fix

                    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),
                    Severity: Major
                    Found in app/graphql/types/doi_item.rb - About 3 hrs to fix

                      File events_controller.rb has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class EventsController < ApplicationController
                        include Identifiable
                      
                        include Facetable
                      
                      
                      Severity: Minor
                      Found in app/controllers/events_controller.rb - About 3 hrs to fix

                        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(
                        Severity: Major
                        Found in app/models/contact.rb - About 3 hrs to fix

                          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" } }
                          Severity: Major
                          Found in app/controllers/provider_prefixes_controller.rb - About 3 hrs to fix

                            Method index has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def index
                                sort =
                                  case params[:sort]
                                  when "relevance"
                                    { "_score" => { order: "desc" } }
                            Severity: Major
                            Found in app/controllers/data_centers_controller.rb - About 3 hrs to fix

                              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" } }
                              Severity: Major
                              Found in app/controllers/repository_prefixes_controller.rb - About 3 hrs to fix

                                File old_events_controller.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                class OldEventsController < ApplicationController
                                  include ActionController::MimeResponds
                                
                                  include Identifiable
                                
                                
                                Severity: Minor
                                Found in app/controllers/old_events_controller.rb - About 3 hrs to fix

                                  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!
                                  
                                  
                                  Severity: Minor
                                  Found in app/controllers/exports_controller.rb - About 3 hrs to fix

                                    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,
                                    Severity: Major
                                    Found in app/models/doi.rb - About 3 hrs to fix

                                      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" } }
                                      Severity: Major
                                      Found in app/controllers/client_prefixes_controller.rb - About 3 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language