Showing 3 of 3 total issues
Method model_data_policy_class
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def model_data_policy_class(model)
model = model.constantize if model.is_a?(String)
return model.data_policy_class if model.respond_to?(:data_policy_class)
prefix = model.data_policy_prefix if model.respond_to?(:data_policy_prefix)
- 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 anonymize_version_object_changes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def anonymize_version_object_changes(version, fields)
return unless version.respond_to?(:object_changes)
object_changes = version.object_changes.deep_dup
return object_changes if object_changes.blank?
- 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 process!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process!
with_lock do
raise InvalidStatusError unless active?
return unless should_process?
- 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"