Showing 91 of 91 total issues
Method returns
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def returns(pgroup_or_options, desc_or_options = nil, options = {}, &block) #:doc:
return unless Apipie.active_dsl?
if desc_or_options.is_a? Hash
- 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
Class MethodDescription
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class MethodDescription
attr_reader :full_description, :method, :resource, :apis, :examples, :see, :formats, :headers, :show
attr_accessor :metadata
def initialize(method, resource, dsl_data)
Class ParamDescription
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ParamDescription
attr_reader :method_description, :name, :desc, :allow_nil, :allow_blank, :validator, :options, :metadata, :show, :as, :validations, :response_only, :request_only
attr_reader :additional_properties, :is_array
attr_accessor :parent, :required
Class Writer
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Writer
class << self
def compressed
Apipie.configuration.compress_examples
end
Method index
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
params[:version] ||= Apipie.configuration.default_version
get_format
Method to_swagger
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_swagger
return if @param_descriptions.blank?
@param_descriptions.each do |param_description|
validate(param_description)
Method validate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def validate(value)
return false if !value.is_a? Hash
BaseValidator.raise_if_missing_params do |missing|
@hash_params&.each do |k, p|
- 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_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 initialize
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(method_description, name, validator, desc_or_options = nil, options = {}, &block)
if desc_or_options.is_a?(Hash)
options = options.merge(desc_or_options)
elsif desc_or_options.is_a?(String)
Function slide
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
, slide: function (type, next) {
var $active = this.$element.find('.item.active')
, $next = next || $active[type]()
, isCycling = this.interval
, direction = type == 'next' ? 'left' : 'right'
Method lines_above_method
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def lines_above_method
added_lines = []
lines_to_add = []
block_level = 0
ensure_line_breaks(controller_content.lines).first(action_line).reverse_each do |line|
- 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 initialize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize(method_description, code, options, scope, block, adapter)
@type_ref = options[:param_group]
@is_array_of = options[:array_of] || false
raise ReturnsMultipleDefinitionError, options if @is_array_of && @type_ref
- 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
Function show
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
, show: function () {
var $tip
, pos
, actualWidth
, actualHeight
Method _apipie_define_validators
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _apipie_define_validators(description)
# [re]define method only if validation is turned on
if description && (Apipie.configuration.validate == true ||
Apipie.configuration.validate == :implicitly ||
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 initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(code_or_options, desc = nil, options = {})
if code_or_options.is_a? Hash
code_or_options.symbolize_keys!
@code = code_or_options[:code]
@metadata = code_or_options[:meta]
- 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 generate_params_code
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def generate_params_code(params, indent = "")
code = ""
params.sort_by {|n,_| n }.each do |(name, desc)|
desc[:type] = (desc[:type] && desc[:type].first) || Object
code << "#{indent}param"
- 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 body_params_schema
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def body_params_schema
if params_in_body? && body_allowed_for_current_method?
composite = Apipie::Generator::Swagger::ParamDescription::Composite.new(
body_param_descriptions,
Apipie::Generator::Swagger::Context.new(
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@markup = Apipie::Markup::RDoc.new
@app_name = "Another API"
@app_info = ActiveSupport::HashWithIndifferentAccess.new
@copyright = nil