UNC-Libraries/hy-c

View on GitHub

Showing 12 of 44 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 306 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class CatalogController < ApplicationController
        include BlacklightAdvancedSearch::Controller
        include BlacklightRangeLimit::ControllerOverride
        include Hydra::Catalog
        include Hydra::Controller::ControllerBehavior
      Severity: Minor
      Found in app/controllers/catalog_controller.rb - About 3 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

            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 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

            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 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

                  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

                    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
                      Severity
                      Category
                      Status
                      Source
                      Language