archivesspace/archivesspace

View on GitHub

Showing 1,475 of 2,432 total issues

Method apply_nested_records has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_nested_records(json, new_record = false)
      self.remove_nested_records if !new_record

      self.class.nested_records.each do |nested_record|
        # Read the subrecords from our JSON blob and fetch or create
Severity: Minor
Found in backend/app/model/ASModel_crud.rb - About 7 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 set_up_base_permissions has 196 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.set_up_base_permissions
    if not Repository[:repo_code => Repository.GLOBAL]
      Repository.create(:repo_code => Repository.GLOBAL,
                        :name => "Global repository",
                        :json_schema_version => JSONModel(:repository).schema_version,
Severity: Major
Found in backend/app/lib/bootstrap_access_control.rb - About 7 hrs to fix

    File bootstrap-accessibility.js has 492 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* ========================================================================
    * Extends Bootstrap v3.1.1
    
    * Copyright (c) <2015> PayPal
    
    

      File trollop.rb has 490 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'date'
      
      module Trollop
      
      VERSION = "2.0"
      Severity: Minor
      Found in launcher/backup/lib/trollop.rb - About 7 hrs to fix

        Method archdesc_dates has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

            def archdesc_dates
              unless @archdesc_dates
                results = []
                dates = self.dates || []
                dates.each do |date|
        Severity: Minor
        Found in backend/app/exporters/lib/export_helpers.rb - About 7 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

        Function initImportJobForm has 188 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var initImportJobForm = function () {
            var supportsHTML5MultipleFileInput = function () {
              var input = document.createElement('input');
              input.setAttribute('multiple', 'true');
              return input.multiple === true;
        Severity: Major
        Found in frontend/app/assets/javascripts/jobs.crud.js - About 7 hrs to fix

          Method process_row has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

            def process_row(row_hash = nil)
              #This allows the processing of a single row
              if (!row_hash.nil?)
                @row_hash = row_hash
              end
          Severity: Minor
          Found in backend/app/lib/bulk_import/top_container_linker_validator.rb - About 7 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

          Function ClipboardAction has 185 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      var ClipboardAction = (function () {
                        /**
                         * @param {Object} options
                         */
                        function ClipboardAction(options) {
          Severity: Major
          Found in frontend/app/assets/javascripts/clipboard.js - About 7 hrs to fix

            Method defaults has 182 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.defaults
                {
                  'show_suppressed' => false,
                  'publish' => false,
                  'rde_sort_alpha' => true,
            Severity: Major
            Found in common/config/preference_defaults.rb - About 7 hrs to fix

              File rest.rb has 465 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module RESTHelpers
              
                include JSONModel
              
              
              
              Severity: Minor
              Found in backend/app/lib/rest.rb - About 7 hrs to fix

                Method serialize_subnotes has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                Open

                  def serialize_subnotes(subnotes, xml, fragments, include_p = true)
                    subnotes.each do |sn|
                      next if sn["publish"] === false && !@include_unpublished
                
                      audatt = sn["publish"] === false ? {:audience => 'internal'} : {}
                Severity: Minor
                Found in backend/app/exporters/serializers/ead3.rb - About 7 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 serialize_subnotes has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                Open

                  def serialize_subnotes(subnotes, xml, fragments, include_p = true)
                    subnotes.each do |sn|
                      next if sn["publish"] === false && !@include_unpublished
                
                      audatt = sn["publish"] === false ? {:audience => 'internal'} : {}
                Severity: Minor
                Found in backend/app/exporters/serializers/ead.rb - About 7 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 migrate_langmaterial_notes has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                Open

                def migrate_langmaterial_notes
                  # Find all langmaterial notes
                  self[:note].each do |note_id|
                    if note_id[:notes].lit.include?('langmaterial')
                
                
                Severity: Minor
                Found in common/db/migrations/123_create_lang_materials_schema.rb - About 7 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

                Class ApplicationController has 50 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class ApplicationController < ActionController::Base
                  protect_from_forgery with: :exception
                
                  helper :all
                
                
                Severity: Minor
                Found in frontend/app/controllers/application_controller.rb - About 7 hrs to fix

                  Class IndexerCommon has 50 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class IndexerCommon
                  
                    include JSONModel
                  
                    @@record_types = IndexerCommonConfig.record_types
                  Severity: Minor
                  Found in indexer/app/lib/indexer_common.rb - About 7 hrs to fix

                    Method add_pref_columns has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def add_pref_columns(models)
                        models = Array(models) unless models.is_a? Array
                        added = []
                        skipped = []
                        if models.length > 1
                    Severity: Minor
                    Found in frontend/app/helpers/search_helper.rb - About 6 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

                    Function TreeLinkingModal has 172 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function TreeLinkingModal(config) {
                      var self = this;
                      self.config = config;
                      self.$modal = AS.openCustomModal(
                        'linkResourceModal',
                    Severity: Major
                    Found in frontend/app/assets/javascripts/archival_objects.crud.js - About 6 hrs to fix

                      Method map_oai_record has 166 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def map_oai_record(record)
                          jsonmodel = record.jsonmodel_record
                          result = Nokogiri::XML::Builder.new do |xml|
                      
                            xml['oai_dcterms'].dcterms('xmlns:dcterms' => 'http://purl.org/dc/terms/',
                      Severity: Major
                      Found in backend/app/lib/oai/mappers/oai_dcterms.rb - About 6 hrs to fix

                        Method serialize_languages has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def serialize_languages(languages, xml, fragments)
                            lm = []
                            language_notes = languages.map {|l| l['notes']}.compact.reject {|e| e == [] }.flatten
                            if !language_notes.empty?
                              language_notes.each do |note|
                        Severity: Minor
                        Found in backend/app/exporters/serializers/ead.rb - About 6 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 cleanup_params_for_schema has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def cleanup_params_for_schema(params_hash, schema)
                            # We're expecting a HashWithIndifferentAccess...
                            if params_hash.respond_to?(:to_unsafe_hash)
                              params_hash = params_hash.to_unsafe_hash
                            end
                        Severity: Minor
                        Found in frontend/app/controllers/application_controller.rb - About 6 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