ManageIQ/manageiq-api

View on GitHub
app/controllers/api/base_controller/normalizer.rb

Summary

Maintainability
A
1 hr
Test Coverage
A
98%

Showing 2 of 2 total issues

Method normalize_hash has a Cognitive Complexity of 21 (exceeds 11 allowed). Consider refactoring.
Open

def normalize_hash(type, obj, opts = {})
Environment.fetch_encrypted_attribute_names(obj.class)
attrs = normalize_select_attributes(obj, opts)
result = {}
 
 
Severity: Minor
Found in app/controllers/api/base_controller/normalizer.rb - About 1 hr to fix

Cyclomatic complexity for normalize_attr is too high. [13/11]
Open

def normalize_attr(attr, value)
return if value.nil?
if value.kind_of?(Array) || value.kind_of?(ActiveRecord::Relation)
normalize_array(value)
elsif value.respond_to?(:attributes) || value.respond_to?(:keys)
Category
Status