datacite/lupo

View on GitHub

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),
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 "name"
                  { "prefix_id" => { order: "asc" } }
          Severity: Major
          Found in app/controllers/repository_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

              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

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

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

                          Method index has 84 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/contacts_controller.rb - About 3 hrs to fix

                            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
                            Severity: Minor
                            Found in app/jobs/event_registrant_update_by_id_job.rb - About 3 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

                            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)
                            Severity: Minor
                            Found in app/jobs/url_job.rb - About 3 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

                            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" } }
                            Severity: Minor
                            Found in app/controllers/providers_controller.rb - About 3 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

                            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" } }
                            Severity: Minor
                            Found in app/controllers/repositories_controller.rb - About 3 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

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

                              File helpable.rb has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              module Helpable
                                extend ActiveSupport::Concern
                              
                                require "bolognese"
                                require "csv"
                              Severity: Minor
                              Found in app/models/concerns/helpable.rb - About 3 hrs to fix

                                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))
                                Severity: Minor
                                Found in app/models/concerns/metadatable.rb - About 3 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

                                Severity
                                Category
                                Status
                                Source
                                Language