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
- 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 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']]
- 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 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
- 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 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
- 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
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"
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]
- 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 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))
- 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 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)
- 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"