Showing 6 of 10 total issues
Method respond_with
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def respond_with(*args, &block)
if args.present? && args.first.is_a?(Cyrax::Response)
response, options = *args
options = {
notice: response.notice,
- 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 sync_errors_with
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def sync_errors_with(model)
model = model.to_model if model.respond_to?(:to_model)
return unless model
(@_errors || {}).each do |key, value|
next unless model.respond_to?(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 respond_with
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def respond_with(*args, &block)
if args.present? && args.first.is_a?(Cyrax::Response)
response, options = *args
options = {
notice: response.notice,
Method update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update(custom_attributes = nil, &block)
resource = build_resource(resource_params_id, custom_attributes||resource_attributes)
authorize_resource!(:update, resource)
transaction do
if save_resource(resource)
- 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 respond_with
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def respond_with(result, options = {})
options[:as] ||= accessor
options[:assignments] = @_assignments
name = options[:name] || response_name
result = result.result.to_model if result.is_a?(Cyrax::Response)
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create(custom_attributes = nil, &block)
resource = build_resource(nil, custom_attributes||resource_attributes)
authorize_resource!(:create, resource)
transaction do
if save_resource(resource)
- 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"