sul-dlss/moab-versioning

View on GitHub
lib/moab/file_inventory.rb

Summary

Maintainability
A
3 hrs
Test Coverage
A
99%

Class FileInventory has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class FileInventory < Serializer::Manifest
    include HappyMapper

    # The name of the XML element used to serialize this object's data
    tag 'fileInventory'
Severity: Minor
Found in lib/moab/file_inventory.rb - About 2 hrs to fix

    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

    There are no issues that match your filters.

    Category
    Status