lib/moab/file_inventory.rb
Class FileInventory
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class FileInventory < Serializer::Manifest
include HappyMapper
# The name of the XML element used to serialize this object's data
tag 'fileInventory'
Method signatures_from_bagit_manifests
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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
- Read upRead up
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
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
- Read upRead up
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"