archivesspace/archivesspace

View on GitHub

Showing 1,469 of 2,413 total issues

File utils.js has 867 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//= require trimpath-template-1.0.38
//= require bootstrap-datepicker
//= require bootstrap-combobox

var AS = {}; // eslint-disable-line
Severity: Major
Found in frontend/app/assets/javascripts/utils.js - About 2 days to fix

    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

    Function init has 416 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 829 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 1 day 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 785 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 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 738 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 715 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

                          File marc_auth.rb has 618 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

                            Method _control has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def _control(json, xml)
                                xml.control do
                                  # AGENT_RECORD_IDENTIFIERS
                                  with(xml, json['agent_record_identifiers']) do |ari|
                                    if ari['primary_identifier'] == true
                            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 sequel_to_jsonmodel has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def sequel_to_jsonmodel(objs, opts = {})
                                  jsons = super
                            
                                  jsons.each do |json|
                                    case self.name
                            Severity: Minor
                            Found in backend/app/model/mixins/representative_file_version.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 merge_record has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def merge_record(json_in, opts)
                                json = json_in.clone
                            
                                direct_only = opts.fetch(:direct_only) { false }
                                remove_ancestors = opts.fetch(:remove_ancestors) { false }
                            Severity: Minor
                            Found in common/record_inheritance.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

                            Severity
                            Category
                            Status
                            Source
                            Language