Method attribute_updates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attribute_updates
changes.reduce({}) do |updates, (key, value)|
# TODO: remove this ternary once aws-sdk accepts empty set pull request
current_value = value[1].is_a?(Set) && value[1].empty? ? nil : value[1]
updates[key] = { action: value[2] || 'PUT' }
- 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 add_to
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_to(attribute, value)
complain_about(attribute) unless self.class.handles[attribute]
old_value = read_attribute(attribute)
add_value = self.class.attribute_callback(TypeHandler::SETTER_PROCS, self.class.handles[attribute], value, true)
if ADDABLE_TYPES.include? self.class.handles[attribute][:format]
- 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 read_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_attribute(name)
value = @attributes[name]
if (handle = self.class.handles[name.to_sym])
value = handle[:options][:default] if value.nil?
value = self.class.attribute_callback(TypeHandler::GETTER_PROCS, handle, value, false) unless value.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"