archivesspace/archivesspace

View on GitHub

Showing 1,505 of 2,469 total issues

File jquery-migrate.js has 962 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery Migrate - v3.4.0 - 2022-03-24T16:30Z
 * Copyright OpenJS Foundation and other contributors
 */
(function (factory) {
Severity: Major
Found in frontend/app/assets/javascripts/jquery-migrate.js - About 2 days to fix

    File jquery.tokeninput.js has 927 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * jQuery Plugin: Tokenizing Autocomplete Text Entry
     * Version 1.6.0
     *
     * Copyright (c) 2009 James Smith (http://loopj.com)
    Severity: Major
    Found in frontend/app/assets/javascripts/jquery.tokeninput.js - About 2 days to fix

      Method serialize_eadheader has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
      Open

        def serialize_eadheader(data, xml, fragments)
          eadid_url = data.ead_location
      
          if AppConfig[:arks_enabled] && data.ark_name && (current_ark = data.ark_name.fetch('current', nil))
            eadid_url = current_ark
      Severity: Minor
      Found in backend/app/exporters/serializers/ead.rb - About 2 days 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 map_oai_record has a Cognitive Complexity of 104 (exceeds 5 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: Minor
      Found in backend/app/lib/oai/mappers/oai_dcterms.rb - About 2 days 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 utils.js has 864 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      //= require trimpath-template-1.0.38
      //= require bootstrap-datepicker
      //= require bootstrap-combobox
      //= require bootstrap-tagsinput
      
      
      Severity: Major
      Found in frontend/app/assets/javascripts/utils.js - About 2 days to fix

        Function init has 418 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var init = function () {
          var $form = $('#job_form');
        
          var initReportJobForm = function () {
            var locationReportSubFormChange = function () {
        Severity: Major
        Found in frontend/app/assets/javascripts/jobs.crud.js - About 2 days to fix

          File marcxml_auth_agent_base_map.rb has 840 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module MarcXMLAuthAgentBaseMap
            # import_events determines whether maintenance events are imported
            # import_subjects determines whether subjects are imported
            def BASE_RECORD_MAP(opts = {:import_events => false, :import_subjects => false})
              import_events   = opts[:import_events]
          Severity: Major
          Found in backend/app/converters/lib/marcxml_auth_agent_base_map.rb - About 2 days to fix

            File ead_converter.rb has 835 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require_relative 'converter'
            require 'set'
            
            class EADConverter < Converter
            
            
            Severity: Major
            Found in backend/app/converters/ead_converter.rb - About 2 days to fix

              Method map_oai_record has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
              Open

                def map_oai_record(record)
                  jsonmodel = record.jsonmodel_record
                  result = Nokogiri::XML::Builder.new do |xml|
                    xml['oai_dc'].dc('xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
                                     'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
              Severity: Minor
              Found in backend/app/lib/oai/mappers/oai_dc.rb - About 1 day 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 ead.rb has 792 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'nokogiri'
              require 'securerandom'
              require 'cgi'
              
              class EADSerializer < ASpaceExport::Serializer
              Severity: Major
              Found in backend/app/exporters/serializers/ead.rb - About 1 day to fix

                File spreadsheet_builder.rb has 783 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class SpreadsheetBuilder
                
                  ALWAYS_FIELDS = ['id', 'lock_version', 'title']
                
                  def initialize(resource_uri, ao_uris, min_subrecords, extra_subrecords, min_notes, selected_columns)
                Severity: Major
                Found in backend/app/model/spreadsheet_builder.rb - About 1 day to fix

                  File clipboard.js has 758 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /*!
                   * clipboard.js v1.6.1
                   * https://zenorocha.github.io/clipboard.js
                   *
                   * Licensed MIT © Zeno Rocha
                  Severity: Major
                  Found in frontend/app/assets/javascripts/clipboard.js - About 1 day to fix

                    File top_containers.bulk.js has 741 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    //= require tablesorter/jquery.tablesorter.min
                    
                    /***************************************************************************
                     * BulkContainerSearch - provides all the behaviour to the ajax search
                     * and selection of records.
                    Severity: Major
                    Found in frontend/app/assets/javascripts/top_containers.bulk.js - About 1 day to fix

                      Method map_oai_record has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def map_oai_record(record)
                          jsonmodel = record.jsonmodel_record
                          result = Nokogiri::XML::Builder.new do |xml|
                      
                            xml.mods('xmlns' => 'http://www.loc.gov/mods/v3',
                      Severity: Minor
                      Found in backend/app/lib/oai/mappers/oai_mods.rb - About 1 day 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 exports.rb has 696 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class ArchivesSpaceService < Sinatra::Base
                        include ExportHelpers
                      
                        Endpoint.get('/repositories/:repo_id/digital_objects/dublin_core/:id.xml')
                          .description("Get a Dublin Core representation of a Digital Object")
                      Severity: Major
                      Found in backend/app/controllers/exports.rb - About 1 day to fix

                        File marc21.rb has 690 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        class MARCModel < ASpaceExport::ExportModel
                          model_for :marc21
                        
                          include JSONModel
                        
                        
                        Severity: Major
                        Found in backend/app/exporters/models/marc21.rb - About 1 day to fix

                          Method _cpfdesc has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def _cpfdesc(json, xml, obj)
                              xml.cpfDescription do
                                xml.identity do
                                  # AGENT_IDENTIFIERS
                                  with(xml, json['agent_identifiers']) do |ad|
                          Severity: Minor
                          Found in backend/app/exporters/serializers/eac.rb - About 1 day 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 run has 291 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def run
                              begin
                                # SETUP
                                @job.write_output("Resetting autogenerated slugs")
                                @job.write_output("================================")
                          Severity: Major
                          Found in backend/app/lib/job_runners/generate_slugs_runner.rb - About 1 day to fix

                            File eac.rb has 648 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class EACSerializer < ASpaceExport::Serializer
                              serializer_for :eac
                            
                              def serialize(eac, _opts = {})
                                builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
                            Severity: Major
                            Found in backend/app/exporters/serializers/eac.rb - About 1 day to fix

                              File validations.rb has 624 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require 'date'
                              require 'time'
                              require 'barcode_check'
                              
                              module JSONModel::Validations
                              Severity: Major
                              Found in common/validations.rb - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language