psu-libraries/psulib_traject

View on GitHub

Showing 20 of 20 total issues

Method extract_link_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_link_data(link_type: 'full')
      lambda do |record, accumulator, _context|
        return unless record.fields('856').any?

        link_data_all = []
Severity: Minor
Found in lib/psulib_traject/macros.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 process_subject_browse_facet has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def process_subject_browse_facet(standard_fields:, pst_fields:)
    lambda do |record, accumulator|
      return unless record.is_a? MARC::Record

      subjects = []
Severity: Minor
Found in lib/psulib_traject/macros/subjects.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 process_genre has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def process_genre(fields)
      lambda do |record, accumulator|
        return nil unless record.is_a? MARC::Record

        genres = []
Severity: Minor
Found in lib/psulib_traject/macros.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 resolve_007 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_007
      [].tap do |results|
        Traject::MarcExtractor.cached('007').collect_matching_lines(record) do |field, _spec, _extractor|
          results << case field.value[0]
                     when 'g'
Severity: Minor
Found in lib/psulib_traject/processors/media_type.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 each has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def each
      return enum_for(:each) unless block_given?

      combinable_records.each do |records_to_combine|
        if records_to_combine.length == 1
Severity: Minor
Found in lib/psulib_traject/marc_combining_reader.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 resolve_949a has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_949a
      [].tap do |results|
        Traject::MarcExtractor.cached('949a').collect_matching_lines(record) do |field, spec, extractor|
          field_949a = extractor.collect_subfields(field, spec).first
          results << 'Blu-ray' if /BLU-RAY/i.match?(field_949a)
Severity: Minor
Found in lib/psulib_traject/processors/media_type.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 resolve_538a has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_538a
      [].tap do |results|
        Traject::MarcExtractor.cached('538a', alternate_script: false).collect_matching_lines(record) do |field, spec, extractor|
          field_538a = extractor.collect_subfields(field, spec).first
          results << 'Blu-ray' if field_538a&.match?(Regexp.union(/Bluray/i, /Blu-ray/i, /Blu ray/i))
Severity: Minor
Found in lib/psulib_traject/processors/media_type.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 process_subject_browse_facet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def process_subject_browse_facet(standard_fields:, pst_fields:)
    lambda do |record, accumulator|
      return unless record.is_a? MARC::Record

      subjects = []
Severity: Minor
Found in lib/psulib_traject/macros/subjects.rb - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

        'Games/Toys' if %w[r m].include?(record.leader[6]) &&
          (%w[g w].include?(record.leader[16]) ||
           (record['006'] && record['006'].value[9] == 'g') ||
           (record['008'] && (%w[g w].include?(record['008'].value[33]) || record['008'].value[26] == 'g')))
Severity: Major
Found in lib/psulib_traject/processors/preferred_format.rb - About 1 hr to fix

Method units has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def units
          [].tap do |collection|
            unit = PeriodicalHoldings.new
            record.fields(PeriodicalHoldings.tags.values).map do |field|
              case field.tag
Severity: Minor
Found in lib/psulib_traject/processors/summary_holdings.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 resolve_300a has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_300a
      [].tap do |results|
        Traject::MarcExtractor.cached('300a', alternate_script: false).collect_matching_lines(record) do |field, spec, extractor|
          field300a = extractor.collect_subfields(field, spec).first
          results << 'Photo' if /photograph/i.match?(field300a)
Severity: Minor
Found in lib/psulib_traject/processors/media_type.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 extract_series_title_display has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_series_title_display
    lambda do |record, accumulator|
      index_string = []
      fields = record.fields

Severity: Minor
Found in lib/psulib_traject/macros/series_title.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 extract_iiif_manifest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_iiif_manifest
      lambda do |record, accumulator|
        return unless record.fields('856').any?

        record.fields('856').each do |field|
Severity: Minor
Found in lib/psulib_traject/macros.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 resolve_300 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_300
      [].tap do |results|
        Traject::MarcExtractor.cached('300abcdefghijklmnopqrstuvwxyz', alternate_script: false)
          .collect_matching_lines(record) do |field, spec, extractor|
            field300 = extractor.collect_subfields(field, spec).first
Severity: Minor
Found in lib/psulib_traject/processors/media_type.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 reduce_dupe_rows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def reduce_dupe_rows(rows)
        rows.reduce do |memo, rec|
          next memo unless memo['access'] != rec['access']

          { 'local_id' => memo['local_id'],
Severity: Minor
Found in lib/psulib_traject/hathi_overlap_reducer.rb - About 35 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 combinable_records has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def combinable_records(&block)
      return enum_for(:combinable_records) unless block

      # See https://github.com/jruby/jruby/issues/5275;
      enumerable = if defined?(JRUBY_VERSION)
Severity: Minor
Found in lib/psulib_traject/marc_combining_reader.rb - About 35 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 process_subject_hierarchy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def process_subject_hierarchy(fields)
    lambda do |record, accumulator|
      return unless record.is_a? MARC::Record

      subjects = []
Severity: Minor
Found in lib/psulib_traject/macros/subjects.rb - About 35 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 process_publication_date has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_publication_date
      lambda do |record, accumulator|
        return nil unless record.is_a? MARC::Record

        processor = Processors::PubDate.new
Severity: Minor
Found in lib/psulib_traject/macros.rb - About 35 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 games has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def games
        'Games/Toys' if %w[r m].include?(record.leader[6]) &&
          (%w[g w].include?(record.leader[16]) ||
           (record['006'] && record['006'].value[9] == 'g') ||
           (record['008'] && (%w[g w].include?(record['008'].value[33]) || record['008'].value[26] == 'g')))
Severity: Minor
Found in lib/psulib_traject/processors/preferred_format.rb - About 35 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 resolve_300b_347b has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_300b_347b
      [].tap do |results|
        Traject::MarcExtractor.cached('300b:347b', alternate_script: false).collect_matching_lines(record) do |field, spec, extractor|
          field_300b_347b = extractor.collect_subfields(field, spec).first
          results << 'MPEG-4' if /MP4/i.match?(field_300b_347b)
Severity: Minor
Found in lib/psulib_traject/processors/media_type.rb - About 25 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

Severity
Category
Status
Source
Language