Method generate_content_metadata
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def generate_content_metadata(file_group, object_id, version_id)
cm = Nokogiri::XML::Builder.new do |xml|
xml.contentMetadata(type: 'sample', objectId: object_id) do
xml.resource(type: 'version', sequence: '1', id: "version-#{version_id}") do
file_group.files.each do |file_manifestation|
- 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 validate_content_metadata_details
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_content_metadata_details(content_metadata)
result = []
content_metadata_doc =
case content_metadata.class.name
when 'String'
Method validate_content_metadata_details
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_content_metadata_details(content_metadata)
result = []
content_metadata_doc =
case content_metadata.class.name
when 'String'
- 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"