Class Application
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Application
# we need engine just for serving static assets
class Engine < Rails::Engine
initializer "static assets", :before => :build_middleware_stack do |app|
app.middleware.use ::Apipie::StaticDispatcher, "#{root}/app/public"
File application.rb
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'apipie/static_dispatcher'
require 'apipie/routes_formatter'
require 'yaml'
require 'digest/sha1'
require 'json'
Method get_resource_description
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_resource_description(resource, version = nil)
if resource.is_a?(String)
crumbs = resource.split('#')
if crumbs.size == 2
version = crumbs.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 get_resource_id
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_resource_id(klass)
if klass.class == String
klass
elsif @controller_to_resource_id.key?(klass)
@controller_to_resource_id[klass]
- 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 valid_search_args?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def valid_search_args?(version, resource_id, method_name)
return false unless self.resource_descriptions.key?(version)
if resource_id
return false unless self.resource_descriptions[version].key?(resource_id)
if method_name
- 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 rails_routes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def rails_routes(route_set = nil, base_url = "")
return @_rails_routes if route_set.nil? && @_rails_routes
route_set ||= Rails.application.routes
# ensure routes are loaded
- 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_json
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_json(version, resource_id, method_name, lang)
return unless valid_search_args?(version, resource_id, method_name)
_resources = if resource_id.blank?
- 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_swagger_json
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def to_swagger_json(version, resource_id, method_name, language, clear_warnings = false)
Method json_schema_for_method_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def json_schema_for_method_response(version, controller_name, method_name, return_code, allow_nulls)
Method define_method_description
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def define_method_description(controller, method_name, dsl_data)
return if ignored?(controller, method_name)
ret_method_description = nil
versions = dsl_data[:api_versions] || []
- 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 define_resource_description
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def define_resource_description(controller, version, dsl_data = nil)
return if ignored?(controller)
resource_id = get_resource_id(controller)
resource_description = @resource_descriptions[version][resource_id]
- 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"