Showing 6 of 6 total issues
Method matching_paths
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def matching_paths(env)
path = env['PATH_INFO']
method = env['REQUEST_METHOD'].downcase
given_query_params = Rack::Utils.parse_nested_query(env['QUERY_STRING'] || "")
# TODO: Only match routes which have the correct "consumes" 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 response
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def response(env)
return @canned_response if @canned_response
catch :halt do
matching_paths = matching_paths(env)
case matching_paths.size
- 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 upload_swagger!
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_swagger!(subdomain, io)
content_type :json
subdomain.downcase!
%w{www meta}.each do |restricted_domain|
Method upload_swagger!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def upload_swagger!(subdomain, io)
content_type :json
subdomain.downcase!
%w{www meta}.each do |restricted_domain|
- 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 matching_paths
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def matching_paths(env)
path = env['PATH_INFO']
method = env['REQUEST_METHOD'].downcase
given_query_params = Rack::Utils.parse_nested_query(env['QUERY_STRING'] || "")
# TODO: Only match routes which have the correct "consumes" value
Method create_example
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_example(env, route)
(route['schema']['definitions'] ||= {}).merge!(@spec['definitions']) if @spec['definitions']
sources = [
ExamplesExampler.from_examples(route['examples']),
SchemaExampler.from_schema(route['schema'])
- 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"