Showing 83 of 87 total issues
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(type, strict = false)
super
@type = type
- 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 check_incompatible_option_values
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_incompatible_option_values(default, values, except_values, excepts)
return unless default && !default.is_a?(Proc)
raise Grape::Exceptions::IncompatibleOptionValues.new(:default, default, :values, values) if values && !values.is_a?(Proc) && !Array(default).all? { |def_val| values.include?(def_val) }
- 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_param!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_param!(attr_name, params)
return unless params.respond_to?(:key?) && params.key?(attr_name)
excepts = @except.is_a?(Proc) ? @except.call : @except
return if excepts.nil?
- 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(attrs, options, required, scope, **opts)
if options.is_a?(Hash)
@excepts = options[:except]
@values = options[:value]
@proc = options[:proc]
- 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 guess_coerce_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def guess_coerce_type(coerce_type, *values_list)
return coerce_type unless coerce_type == Array
values_list.each do |values|
next if !values || values.is_a?(Proc)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def call(message, backtrace, options = {}, env = nil, original_exception = nil)
message = present(message, env)
result = message.is_a?(Hash) ? ::Grape::Json.dump(message) : message
Array.wrap(result).tap do |final_result|
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def call(message, backtrace, options = {}, env = nil, original_exception = nil)
message = present(message, env)
result = message.is_a?(Hash) ? message : { message: message }
rescue_options = options[:rescue_options] || {}
- 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 header
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def header(key = nil, val = nil)
if key
val ? header[key.to_s] = val : header.delete(key.to_s)
else
@header ||= Grape::Util::Header.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 validate_param!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_param!(attr_name, params)
return if (options_key?(:value) ? @option[:value] : @option) || !params.is_a?(Hash)
value = params[attr_name]
value = value.strip if value.respond_to?(:strip)
- 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
Consider simplifying this complex logical expression. Open
return unless (!@min.nil? && param.length < @min) || (!@max.nil? && param.length > @max) || (!@is.nil? && param.length != @is)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(attrs, options, required, scope, **opts)
Method call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call(message, backtrace, options = {}, env = nil, original_exception = nil)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(attrs, options, required, scope, *opts)
Method declared_hash_attr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def declared_hash_attr(passed_params, options, declared_param, params_nested_path, memo)
Method error!
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def error!(message, status = options[:default_status], headers = {}, backtrace = [], original_exception = nil)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(attrs, options, required, scope, **opts)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(attrs, options, required, scope, **opts)
Method validate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate(type, options, attrs, doc, opts)
Method call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call(message, backtrace, options = {}, env = nil, original_exception = nil)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(attrs, options, required, scope, **opts)