archivesspace/archivesspace

View on GitHub
backend/app/exporters/models/marc21.rb

Summary

Maintainability
F
1 wk
Test Coverage

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

    Class MARCModel has 40 methods (exceeds 20 allowed). Consider refactoring.
    Open

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

      Method handle_notes has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

        def handle_notes(notes)
          notes.each do |note|
            prefix =  case note['type']
                      when 'dimensions'; "Dimensions"
                      when 'physdesc'; "Physical Description note"
      Severity: Minor
      Found in backend/app/exporters/models/marc21.rb - About 4 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 handle_agent_corporate_punctuation has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        def handle_agent_corporate_punctuation(name_fields)
          name_fields.sort! {|a, b| a[0][0] <=> b[0][0]}
      
          # The value of subfield g must be enclosed in parentheses.
          g_index = name_fields.find_index {|a| a[0] == "g"}
      Severity: Minor
      Found in backend/app/exporters/models/marc21.rb - About 3 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 handle_other_creators has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        def handle_other_creators(linked_agents)
          primary_creator = linked_agents.find {|a| a['is_primary'] && a['role'] == 'creator'}
      
          # if there is NOT a primary creator, automatically exclude the first in the list
          # of creators to get 7xx tags since it was chosen as primary in #handle_primary_creator above
      Severity: Minor
      Found in backend/app/exporters/models/marc21.rb - About 2 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 handle_notes has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def handle_notes(notes)
          notes.each do |note|
            prefix =  case note['type']
                      when 'dimensions'; "Dimensions"
                      when 'physdesc'; "Physical Description note"
      Severity: Major
      Found in backend/app/exporters/models/marc21.rb - About 2 hrs to fix

        Method gather_agent_corporate_subfield_mappings has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def gather_agent_corporate_subfield_mappings(name, role_info, agent, terms=nil)
            subfield_e, subfield_4 = prepare_role_subfields(role_info)
            primary_name = name['primary_name'] rescue nil
            sub_name1    = name['subordinate_name_1'] rescue nil
            sub_name2    = name['subordinate_name_2'] rescue nil
        Severity: Minor
        Found in backend/app/exporters/models/marc21.rb - About 2 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 handle_agents has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def handle_agents(linked_agents)
            handle_primary_creator(linked_agents)
            handle_other_creators(linked_agents)
        
            subjects = linked_agents.select {|a| a['role'] == 'subject'}
        Severity: Minor
        Found in backend/app/exporters/models/marc21.rb - About 2 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 gather_agent_person_subfield_mappings has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def gather_agent_person_subfield_mappings(name, role_info, agent, terms=nil)
            joint = name['name_order'] == 'direct' ? ' ' : ', '
            name_parts = [name['primary_name'], name['rest_of_name']].reject {|i| i.nil? || i.empty?}.join(joint)
        
            subfield_e, subfield_4 = prepare_role_subfields(role_info)
        Severity: Minor
        Found in backend/app/exporters/models/marc21.rb - About 2 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 handle_title has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          def handle_title(title, linked_agents, dates)
            creator = linked_agents.find {|a| a['role'] == 'creator'}
            date_codes = []
        
            # process dates first, if defined.
        Severity: Minor
        Found in backend/app/exporters/models/marc21.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 handle_primary_creator has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def handle_primary_creator(linked_agents)
            # ANW-504: get look for primary flag and creator role to find primary agent
            primary_creator = linked_agents.find {|a| a['is_primary'] && a['role'] == 'creator'}
        
            # use primary creator as 1xx agent, if present
        Severity: Minor
        Found in backend/app/exporters/models/marc21.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 assemble_controlfield_string has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.assemble_controlfield_string(obj)
            date = obj.dates[0] || {}
            string = obj['system_mtime'].scan(/\d{2}/)[1..3].join('')
            string += date['date_type'] == 'single' ? 's' : 'i'
            string += date['begin'] ? date['begin'][0..3] : "    "
        Severity: Minor
        Found in backend/app/exporters/models/marc21.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 handle_subjects has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def handle_subjects(subjects)
            subjects.each do |link|
              subject = link['_resolved']
              term, *terms = subject['terms']
              code, ind2 =  case term['term_type']
        Severity: Minor
        Found in backend/app/exporters/models/marc21.rb - About 1 hr to fix

          Method handle_other_creators has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def handle_other_creators(linked_agents)
              primary_creator = linked_agents.find {|a| a['is_primary'] && a['role'] == 'creator'}
          
              # if there is NOT a primary creator, automatically exclude the first in the list
              # of creators to get 7xx tags since it was chosen as primary in #handle_primary_creator above
          Severity: Minor
          Found in backend/app/exporters/models/marc21.rb - About 1 hr to fix

            Method handle_agents has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def handle_agents(linked_agents)
                handle_primary_creator(linked_agents)
                handle_other_creators(linked_agents)
            
                subjects = linked_agents.select {|a| a['role'] == 'subject'}
            Severity: Minor
            Found in backend/app/exporters/models/marc21.rb - About 1 hr to fix

              Method gather_agent_family_subfield_mappings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def gather_agent_family_subfield_mappings(name, role_info, agent, terms=nil)
                  subfield_e, subfield_4 = prepare_role_subfields(role_info)
                  family_name = name['family_name'] rescue nil
                  qualifier   = name['qualifier'] rescue nil
                  dates       = name['dates'] rescue nil
              Severity: Minor
              Found in backend/app/exporters/models/marc21.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 gather_agent_corporate_subfield_mappings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def gather_agent_corporate_subfield_mappings(name, role_info, agent, terms=nil)
                  subfield_e, subfield_4 = prepare_role_subfields(role_info)
                  primary_name = name['primary_name'] rescue nil
                  sub_name1    = name['subordinate_name_1'] rescue nil
                  sub_name2    = name['subordinate_name_2'] rescue nil
              Severity: Minor
              Found in backend/app/exporters/models/marc21.rb - About 1 hr to fix

                Method handle_primary_creator has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def handle_primary_creator(linked_agents)
                    # ANW-504: get look for primary flag and creator role to find primary agent
                    primary_creator = linked_agents.find {|a| a['is_primary'] && a['role'] == 'creator'}
                
                    # use primary creator as 1xx agent, if present
                Severity: Minor
                Found in backend/app/exporters/models/marc21.rb - About 1 hr to fix

                  Method handle_agent_person_punctuation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def handle_agent_person_punctuation(name_fields)
                      #The value of subfields g and q must be enclosed in parentheses.
                      ['g', 'q'].each do |sf|
                        index = name_fields.find_index {|a| a[0] == sf}
                        unless !index
                  Severity: Minor
                  Found in backend/app/exporters/models/marc21.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 handle_agent_corporate_punctuation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def handle_agent_corporate_punctuation(name_fields)
                      name_fields.sort! {|a, b| a[0][0] <=> b[0][0]}
                  
                      # The value of subfield g must be enclosed in parentheses.
                      g_index = name_fields.find_index {|a| a[0] == "g"}
                  Severity: Minor
                  Found in backend/app/exporters/models/marc21.rb - About 1 hr to fix

                    Method gather_agent_person_subfield_mappings has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def gather_agent_person_subfield_mappings(name, role_info, agent, terms=nil)
                        joint = name['name_order'] == 'direct' ? ' ' : ', '
                        name_parts = [name['primary_name'], name['rest_of_name']].reject {|i| i.nil? || i.empty?}.join(joint)
                    
                        subfield_e, subfield_4 = prepare_role_subfields(role_info)
                    Severity: Minor
                    Found in backend/app/exporters/models/marc21.rb - About 1 hr to fix

                      Method handle_subjects has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def handle_subjects(subjects)
                          subjects.each do |link|
                            subject = link['_resolved']
                            term, *terms = subject['terms']
                            code, ind2 =  case term['term_type']
                      Severity: Minor
                      Found in backend/app/exporters/models/marc21.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 handle_dates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def handle_dates(dates)
                          return false if dates.empty?
                      
                          dates = [["single", "inclusive", "range"], ["bulk"]].map {|types|
                            dates.find {|date| types.include? date['date_type'] }
                      Severity: Minor
                      Found in backend/app/exporters/models/marc21.rb - About 55 mins 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 handle_ead_loc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def handle_ead_loc(ead_loc, publish, uri, slug)
                          # If there is EADlocation
                          #<datafield tag="856" ind1="4" ind2="2">
                          #  <subfield code="z">Finding aid online:</subfield>
                          #  <subfield code="u">EADlocation</subfield>
                      Severity: Minor
                      Found in backend/app/exporters/models/marc21.rb - About 55 mins 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 handle_repo_code has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def handle_repo_code(repository, *finding_aid_language)
                          repo = repository['_resolved']
                          return false unless repo
                      
                          sfa = repo['org_code'] ? repo['org_code'] : "Repository: #{repo['repo_code']}"
                      Severity: Minor
                      Found in backend/app/exporters/models/marc21.rb - About 45 mins 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 handle_ark has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def handle_ark(ark_name)
                          return if ark_name.nil?
                          return unless [:arks_enabled]
                      
                          # If ARKs are enabled, add an 856
                      Severity: Minor
                      Found in backend/app/exporters/models/marc21.rb - About 45 mins 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 handle_agent_family_punctuation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def handle_agent_family_punctuation(name_fields)
                          # TODO: DRY this up eventually. Leaving it as it is for now in case the logic changes.
                          #If subfield $d is present, the value of the preceding subfield must end in a colon.
                          #If subfield $c is present, the value of the preceding subfield must end in a colon.
                          #If subfield $e is present, the value of the preceding subfield must end in a comma.
                      Severity: Minor
                      Found in backend/app/exporters/models/marc21.rb - About 45 mins 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 df_handler has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def self.df_handler(name, tag, ind1, ind2, code)
                      Severity: Minor
                      Found in backend/app/exporters/models/marc21.rb - About 35 mins to fix

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

                            ['d', 'c', 'e'].each do |subfield|
                              s_index = name_fields.find_index {|a| a[0] == subfield}
                        
                              # check if $subfield is present
                        
                        
                        Severity: Major
                        Found in backend/app/exporters/models/marc21.rb and 2 other locations - About 1 hr to fix
                        backend/app/exporters/models/marc21.rb on lines 746..757
                        backend/app/exporters/models/marc21.rb on lines 890..902

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

                        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 3 locations. Consider refactoring.
                        Open

                            ['e', 'n', 'g'].each do |subfield|
                              s_index = name_fields.find_index {|a| a[0] == subfield}
                        
                              # check if $subfield is present
                        
                        
                        Severity: Major
                        Found in backend/app/exporters/models/marc21.rb and 2 other locations - About 1 hr to fix
                        backend/app/exporters/models/marc21.rb on lines 746..757
                        backend/app/exporters/models/marc21.rb on lines 820..832

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

                        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 3 locations. Consider refactoring.
                        Open

                            ['c', 'd', 'e'].each do |subfield|
                              s_index = name_fields.find_index {|a| a[0] == subfield}
                        
                              # check if $subfield is present
                              unless !s_index || s_index == 0
                        Severity: Major
                        Found in backend/app/exporters/models/marc21.rb and 2 other locations - About 1 hr to fix
                        backend/app/exporters/models/marc21.rb on lines 820..832
                        backend/app/exporters/models/marc21.rb on lines 890..902

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

                        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

                            case creator['agent_type']
                        
                            when 'agent_corporate_entity'
                              code = '110'
                              ind1 = '2'
                        Severity: Minor
                        Found in backend/app/exporters/models/marc21.rb and 1 other location - About 1 hr to fix
                        backend/app/exporters/models/marc21.rb on lines 423..438

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

                        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

                              case creator['agent_type']
                        
                              when 'agent_corporate_entity'
                                code = '710'
                                ind1 = '2'
                        Severity: Minor
                        Found in backend/app/exporters/models/marc21.rb and 1 other location - About 1 hr to fix
                        backend/app/exporters/models/marc21.rb on lines 366..381

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

                        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

                                tag = case t['term_type']
                                      when 'uniform_title'; 't'
                                      when 'genre_form', 'style_period'; 'v'
                                      when 'topical', 'cultural_context'; 'x'
                                      when 'temporal'; 'y'
                        Severity: Minor
                        Found in backend/app/exporters/models/marc21.rb and 1 other location - About 20 mins to fix
                        backend/app/exporters/models/marc21.rb on lines 516..521

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

                        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

                              tag = case t['term_type']
                                    when 'uniform_title'; 't'
                                    when 'genre_form', 'style_period'; 'v'
                                    when 'topical', 'cultural_context'; 'x'
                                    when 'temporal'; 'y'
                        Severity: Minor
                        Found in backend/app/exporters/models/marc21.rb and 1 other location - About 20 mins to fix
                        backend/app/exporters/models/marc21.rb on lines 315..320

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

                        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

                        There are no issues that match your filters.

                        Category
                        Status