Showing 8 of 8 total issues
Class Endpoint
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Endpoint
# Raised when render is called and a response body is already present.
class DoubleRenderError < StandardError
end
Class API
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class API
METHODS = %w[GET POST PUT PATCH DELETE]
SEPARATORS = %w[ / . ? ]
Method call
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def call env
status, headers, body = @app.call env
if status == 200 && !env['crepe.status']
case env['REQUEST_METHOD']
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def call env
@env = env
halt = catch :halt do
begin
- 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 handle_exception
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_exception exception
classes = config[:rescuers].keys.select { |c| exception.is_a? c }
if handler = config[:rescuers][classes.sort.first]
handler = method handler if handler.is_a? Symbol
- 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 cache_control_header
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cache_control_header
return 'max-age=0, private, must-revalidate' if cache_control.empty?
header = cache_control.map do |key, value|
next unless 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 helper
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def helper mod = nil, prepend: false, &block
if block
warn 'block takes precedence over module' if mod
config[:endpoint].class_eval(&block)
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 generate_options_routes!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_options_routes!
paths = routes.group_by { |_, cond| cond[:path_info] }
paths.each do |path, options|
allowed = options.map { |_, cond| cond[:request_method] }
next if allowed.include?('OPTIONS') || allowed.none?
- 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"