archivesspace/archivesspace

View on GitHub

Showing 2,413 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

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

              $("[name$='[rights_type]']", subform).change(function (event) {
                var type = $(this).val();
          
                var values = {};
          
          
          Severity: Major
          Found in frontend/app/assets/javascripts/rights_statements.crud.js and 1 other location - About 1 day to fix
          frontend/app/assets/javascripts/dates.crud.js on lines 3..46

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 337.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              $("[name$='[date_type]']", subform).change(function (event) {
                var type = $(this).val();
          
                var values = {};
          
          
          Severity: Major
          Found in frontend/app/assets/javascripts/dates.crud.js and 1 other location - About 1 day to fix
          frontend/app/assets/javascripts/rights_statements.crud.js on lines 4..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 337.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

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

              BulkActionBarcodeRapidEntry.prototype.setup_form_submission = function (
                $modal
              ) {
                var self = this;
                var $form = $modal.find('form');
              Severity: Major
              Found in frontend/app/assets/javascripts/top_containers.bulk.js and 1 other location - About 1 day to fix
              frontend/app/assets/javascripts/top_containers.bulk.js on lines 752..782

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 311.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

              BulkActionIndicatorRapidEntry.prototype.setup_form_submission = function (
                $modal
              ) {
                var self = this;
                var $form = $modal.find('form');
              Severity: Major
              Found in frontend/app/assets/javascripts/top_containers.bulk.js and 1 other location - About 1 day to fix
              frontend/app/assets/javascripts/top_containers.bulk.js on lines 657..687

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 311.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

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

                      $.fn.init_archival_object_form = function () {
                        $(this).each(function () {
                          var $this = $(this);
                    
                          if ($this.hasClass('initialised')) {
                    Severity: Major
                    Found in frontend/app/assets/javascripts/archival_object.crud.js and 1 other location - About 1 day to fix
                    frontend/app/assets/javascripts/archival_objects.crud.js on lines 550..582

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 269.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                      $.fn.init_archival_object_form = function () {
                        $(this).each(function () {
                          var $this = $(this);
                    
                          if ($this.hasClass('initialised')) {
                    Severity: Major
                    Found in frontend/app/assets/javascripts/archival_objects.crud.js and 1 other location - About 1 day to fix
                    frontend/app/assets/javascripts/archival_object.crud.js on lines 7..39

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 269.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

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