Class MoveParams
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class MoveParams
class << self
attr_accessor :definitions
def can_be_moved?(params, http_verb)
Method prepare_nested_types
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def prepare_nested_types(params)
params.each do |param|
next unless param[:items]
param[:type] = param[:items][:type] == 'array' ? 'string' : param[:items][:type]
param[:format] = param[:items][:format] if param[:items][: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 build_properties
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_properties(params)
properties = {}
required = []
prepare_nested_types(params) if should_expose_as_array?(params)
- 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 document_as_property
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def document_as_property(param)
property_keys.each_with_object({}) do |x, memo|
value = param[x]
next if value.blank?
if x == :type && @definitions[value].present?
- 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 unify!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unify!(params)
params.each { |x| x[:in] = x.delete(:param_type) if x[:param_type] }
params.each { |x| x[:in] = 'body' if x[:in] == 'formData' } if includes_body_param?(params)
end
- 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 move_params_to_new
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def move_params_to_new(definition, params)
params, nested_params = params.partition { |x| !x[:name].to_s.include?('[') }
unless params.blank?
properties, required = build_properties(params)
- 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"