sul-dlss/moab-versioning

View on GitHub

Showing 28 of 32 total issues

Method array_to_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def array_to_hash(array, summary = false)
      item_hash = {}
      array.each_index do |index|
        item = array[index]
        ikey = item.respond_to?(:key) && item.key ? item.key : index
Severity: Minor
Found in lib/serializer/serializable.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 remediate_checksum_nodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remediate_checksum_nodes(file_node, signature)
      # collect <checksum> elements for checksum types that are already present
      checksum_nodes = {}
      file_node.xpath('checksum').each do |checksum_node|
        type = @type_for_name[checksum_node['type']]
Severity: Minor
Found in lib/stanford/content_inventory.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 verify_version_inventory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_version_inventory
      result = VerificationResult.new('version_inventory')
      version_inventory = file_inventory('version')
      result.subentities << VerificationResult.verify_value('inventory_key', composite_key, version_inventory.composite_key)
      signature_catalog = self.signature_catalog
Severity: Minor
Found in lib/moab/storage_object_version.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 signatures_from_bagit_manifests has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def signatures_from_bagit_manifests(bag_pathname)
      manifest_pathname = {}
      DEFAULT_CHECKSUM_TYPES.each do |type|
        manifest_pathname[type] = bag_pathname.join("manifest-#{type}.txt")
      end
Severity: Minor
Found in lib/moab/file_inventory.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 data_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def data_source
      data_source = (groups.collect { |g| g.data_source.to_s }).join('|')
      if data_source.start_with?('contentMetadata')
        version_id ? "v#{version_id}-#{data_source}" : "new-#{data_source}"
      else
Severity: Minor
Found in lib/moab/file_inventory.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

Method key_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def key_name
      unless defined?(@key_name)
        @key_name = nil
        self.class.attributes.each do |attribute|
          if attribute.options[:key]
Severity: Minor
Found in lib/serializer/serializable.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

Method check_required_manifest_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_required_manifest_files(dir, version)
      return [result_hash(NO_FILES_IN_MANIFEST_DIR, version)] unless contains_file?(File.join(dir, MANIFESTS_DIR))

      errors = []
      errors << result_hash(NO_MANIFEST_INVENTORY, version) unless File.exist?(File.join(dir, MANIFEST_INVENTORY_PATH))
Severity: Minor
Found in lib/moab/storage_object_validator.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

Method reconstuct_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reconstuct_group(group_id, storage_object_dir)
      group = bag_inventory.group(group_id)
      return nil? if group.nil? || group.files.empty?

      target_dir = bag_pathname.join('data', group_id)
Severity: Minor
Found in lib/moab/bagger.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