Showing 68 of 91 total issues
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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(value)
return true if allow_nil && value.nil?
return true if allow_blank && value.blank?
value = normalized_value(value)
if (!allow_nil && value.nil?) || (blank_forbidden? && value.blank?) || !validator.valid?(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 initialize
has 27 lines of code (exceeds 25 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
Method refine_params_description
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def refine_params_description(params_desc, recorded_params)
recorded_params.each do |key, value|
params_desc[key] ||= {}
param_desc = params_desc[key]
Function keydown
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
, keydown: function (e) {
var $this
, $items
, $active
, $parent
Method action_awareness
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def action_awareness
if action_aware?
if !@options.key?(:allow_nil)
if @required
@allow_nil = false
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(args)
if args.first.is_a? Hash
args = args.first
elsif args.count == 2
if args.last.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
Method get_format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_format
[:resource, :method, :version].each do |par|
next unless params[par]
[:html, :json].each do |format|
extension = ".#{format}"
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(method_description, name, validator, desc_or_options = nil, options = {}, &block)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(method_description, code, options, scope, block, adapter)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(controller_name, method_name, response_code, error_messages, schema, returned_object)
Method reformat_multipart_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reformat_multipart_data(form)
form.empty? and return ''
lines = ["Content-Type: multipart/form-data; boundary=#{MULTIPART_BOUNDARY}",'']
boundary = "--#{MULTIPART_BOUNDARY}"
form.each do |key, attrs|
- 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 a Cognitive Complexity of 8 (exceeds 5 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(
- 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 property
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def property(param_name, validator, desc_or_options = nil, options = {}, &block) #:doc:
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 param
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def param(param_name, validator, desc_or_options = nil, options = {}, &block) #:doc:
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 to_swagger_json
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.to_swagger_json(version = nil, resource_id = nil, method_name = nil, lang = nil, clear_warnings = true)
Method ensure_line_breaks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ensure_line_breaks(lines)
if lines.to_a.size > 1 && lines.first !~ /\n\Z/
lines.map { |l| !/\n\Z/.match?(l) ? (l << "\n") : l }.to_enum
else
lines
- 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 merge_old_new_examples
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def merge_old_new_examples
new_examples = self.load_new_examples
old_examples = self.load_recorded_examples
merged_examples = []
(new_examples.keys + old_examples.keys).uniq.each do |key|
- 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"