Showing 7 of 51 total issues
Method default_rejection_handler
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def default_rejection_handler(rejections)
puts "handle_rejections: #{rejections}"
if rejections.empty?
fail_with 404
else
Method convert_param_type
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def convert_param_type(value, type)
if type == String then value
elsif type == Symbol then value.to_sym
elsif type == Bignum || type == Fixnum || type == Integer then Integer(value)
elsif type == Float then Float(value)
- 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 call!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call!(env)
@context = Routing::Context.new(Request.new(Rack::Request.new(env)), Response.new)
accept = @context.request.header('Accept')
response_marshaller = accept ? self.class.response_marshaller(accept.media_ranges) : self.class.marshallers.first
- 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 params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def params(*param_defs)
param_hash do |hash|
values = Array(param_defs).map do |param_def|
if param_def.respond_to?(:has_key?)
name, settings = param_def.each_pair.first
- 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 default_rejection_handler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def default_rejection_handler(rejections)
puts "handle_rejections: #{rejections}"
if rejections.empty?
fail_with 404
else
- 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 marshallers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def marshallers(*marshallers)
@marshallers = marshallers unless marshallers.nil? || marshallers.empty?
(@marshallers.nil? || @marshallers.empty?) ? DEFAULT_MARSHALLERS : @marshallers
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 to_s
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_s
s = ''
s << @name if @name
s << '/' << @version if @version
if @comment
- 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"