UNC-Libraries/hy-c

View on GitHub

Showing 38 of 43 total issues

Class SolrDocument has 72 methods (exceeds 20 allowed). Consider refactoring.
Open

class SolrDocument
include Blacklight::Solr::Document
include BlacklightOaiProvider::SolrDocument
 
use_extension Blacklight::Document::DublinCore
Severity: Major
Found in app/models/solr_document.rb - About 1 day to fix

    Class JatsIngestWork has 39 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class JatsIngestWork
    include ActiveModel
    attr_reader :xml_path
     
    def initialize(xml_path:)
    Severity: Minor
    Found in app/models/jats_ingest_work.rb - About 5 hrs to fix

      File catalog_controller.rb has 339 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class CatalogController < ApplicationController
      def self.turnstile_enabled?
      @turnstile_enabled ||= ENV.fetch('CF_TURNSTILE_ENABLED', 'false').downcase == 'true'
      end
      before_action { |controller| BotDetectController.bot_detection_enforce_filter(controller) if self.class.turnstile_enabled? }
      Severity: Minor
      Found in app/controllers/catalog_controller.rb - About 4 hrs to fix

        File doi_create_service.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Tasks
        class DoiCreateService
        include HycHelper
         
        # From page 38 https://schema.datacite.org/meta/kernel-4.2/doc/DataCite-MetadataKernel_v4.2.pdf
        Severity: Minor
        Found in app/services/tasks/doi_create_service.rb - About 2 hrs to fix

          File proquest_ingest_service.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Tasks
          require 'fileutils'
          require 'htmlentities'
          require 'zip'
          require 'tasks/migration_helper'
          Severity: Minor
          Found in app/services/tasks/proquest_ingest_service.rb - About 2 hrs to fix

            Method add_assertions has a Cognitive Complexity of 33 (exceeds 24 allowed). Consider refactoring.
            Open

            def add_assertions(prefix_method, solr_doc = {})
            fields.each do |field_key, field_info|
            if person_fields.include? field_key.to_s
            unless field_info.values.blank?
            field_to_use = field_key == 'based_near' ? field_info : field_info.behaviors
            Severity: Minor
            Found in app/overrides/lib/active-fedora/rdf/indexing_service_override.rb - About 1 hr to fix

            Method model_attributes has a Cognitive Complexity of 33 (exceeds 24 allowed). Consider refactoring.
            Open

            def self.model_attributes(form_params)
            agreement = form_params['agreement']
            attrs = super
             
            single_value_fields.each do |field|
            Severity: Minor
            Found in app/forms/single_value_form.rb - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            def self.build_permitted_params
            permitted = super
            permitted << { advisors_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
            permitted << { contributors_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
            permitted << { creators_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
            Severity: Major
            Found in app/forms/hyrax/dissertation_form.rb and 1 other location - About 1 hr to fix
            app/forms/hyrax/data_set_form.rb on lines 60..66

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            def self.build_permitted_params
            permitted = super
            permitted << { contributors_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
            permitted << { creators_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
            permitted << { project_directors_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
            Severity: Major
            Found in app/forms/hyrax/data_set_form.rb and 1 other location - About 1 hr to fix
            app/forms/hyrax/dissertation_form.rb on lines 56..62

            Method doi_update_request has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def doi_update_request(id, data, retries, doi_update_url, datacite_user, datacite_password)
            Severity: Minor
            Found in app/services/tasks/update_doi_urls_service.rb - About 45 mins to fix

              Method combined_stats has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def combined_stats(object, start_date, object_method, ga_key, user_id = nil)
              Severity: Minor
              Found in app/overrides/models/hyrax/statistic_override.rb - About 35 mins to fix

                Method notify_reviewers has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def self.notify_reviewers(work, work_id, group_name, type, access)
                Severity: Minor
                Found in app/services/hyrax/workflow/assign_reviewer_by_affiliation.rb - About 35 mins to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                  def self.include_current_value(value, _index, render_options, html_options)
                  unless value.blank?
                  html_options[:class] << ' force-select'
                  # Add the current value to the options if it is not already present
                  value_index = render_options.index { |opt| opt[0] == value }
                  Severity: Minor
                  Found in app/services/masters_papers_depts_service.rb and 1 other location - About 35 mins to fix
                  app/services/departments_service.rb on lines 42..49

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                  def self.include_current_value(value, _index, render_options, html_options)
                  unless value.blank?
                  html_options[:class] << ' force-select'
                  # Add the current value to the options if it is not already present
                  value_index = render_options.index { |opt| opt[0] == value }
                  Severity: Minor
                  Found in app/services/departments_service.rb and 1 other location - About 35 mins to fix
                  app/services/masters_papers_depts_service.rb on lines 23..30

                  Avoid too many return statements within this method.
                  Open

                  return object.suppressed? if object.respond_to?(:suppressed?)
                  Severity: Major
                  Found in app/overrides/helpers/hyrax/workflows_helper_override.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                    return false if !can?(:download, file_set)
                    Severity: Major
                    Found in app/overrides/helpers/hyrax/file_set_helper_override.rb - About 30 mins to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                      class HonorsThesisPresenter < Hyrax::WorkShowPresenter
                      delegate :abstract, :academic_concentration, :admin_note, :advisor_display, :alternative_title, :award,
                      :creator_display, :date_issued, :dcmi_type, :degree, :degree_granting_institution, :deposit_record, :doi,
                      :extent, :graduation_year, :language_label, :license_label, :note,
                      :rights_statement_label, :url, to: :solr_document
                      Severity: Minor
                      Found in app/presenters/hyrax/honors_thesis_presenter.rb and 1 other location - About 25 mins to fix
                      app/presenters/hyrax/dissertation_presenter.rb on lines 5..13

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                      class DissertationPresenter < Hyrax::WorkShowPresenter
                      delegate :abstract, :admin_note, :advisor_display, :alternative_title, :contributor_display,
                      :creator_display, :date_issued, :dcmi_type, :degree, :degree_granting_institution, :deposit_record, :doi,
                      :graduation_year, :language_label, :license_label, :note, :place_of_publication,
                      :resource_type, :reviewer_display, :rights_statement_label, to: :solr_document
                      Severity: Minor
                      Found in app/presenters/hyrax/dissertation_presenter.rb and 1 other location - About 25 mins to fix
                      app/presenters/hyrax/honors_thesis_presenter.rb on lines 5..13

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                      def self.build_permitted_params
                      permitted = super
                      permitted << { creators_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
                      permitted << { translators_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
                      permitted
                      Severity: Minor
                      Found in app/forms/hyrax/article_form.rb and 2 other locations - About 25 mins to fix
                      app/forms/hyrax/honors_thesis_form.rb on lines 50..54
                      app/forms/hyrax/scholarly_work_form.rb on lines 48..52

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                      def self.build_permitted_params
                      permitted = super
                      permitted << { advisors_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
                      permitted << { creators_attributes: [:id, :index, :name, :affiliation, :orcid, :other_affiliation, :_destroy] }
                      permitted
                      Severity: Minor
                      Found in app/forms/hyrax/scholarly_work_form.rb and 2 other locations - About 25 mins to fix
                      app/forms/hyrax/article_form.rb on lines 52..56
                      app/forms/hyrax/honors_thesis_form.rb on lines 50..54
                      Severity
                      Category
                      Status
                      Source
                      Language