Method generate_diff
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def generate_diff(app_manifests, space)
json_diff = []
recognized_top_level_keys = AppManifestMessage.allowed_keys.map(&:to_s).map(&:dasherize)
- 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 filter_manifest_app_hash
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter_manifest_app_hash(manifest_app_hash)
if manifest_app_hash.key? 'sidecars'
manifest_app_hash['sidecars'] = manifest_app_hash['sidecars'].map do |hash|
hash.slice(
'name',
Method filter_manifest_app_hash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def filter_manifest_app_hash(manifest_app_hash)
if manifest_app_hash.key? 'sidecars'
manifest_app_hash['sidecars'] = manifest_app_hash['sidecars'].map do |hash|
hash.slice(
'name',
- 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 create_similarity
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_similarity
lambda do |before, after|
return nil unless before.is_a?(Hash) && after.is_a?(Hash)
if before.key?('type') && after.key?('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 generate_diff
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_diff(app_manifests, space)
json_diff = []
recognized_top_level_keys = AppManifestMessage.allowed_keys.map(&:to_s).map(&:dasherize)
Method normalize_units
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def normalize_units(manifest_app_hash)
byte_measurement_key_words = %w[memory disk-quota disk_quota]
manifest_app_hash.each_with_index do |process_hash, index|
byte_measurement_key_words.each do |key|
value = process_hash[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 remove_default_missing_fields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove_default_missing_fields(existing_value, current_key, value)
identifying_field = IDENTIFIERS[current_key]
existing_value.each_with_index do |resource, i|
manifest_app_hash_resource = value.find { |hash_resource| hash_resource[identifying_field] == resource[identifying_field] }
if manifest_app_hash_resource.nil?
- 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"