Showing 829 of 829 total issues
Method show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def show
item = @item
if (json_path = request.headers['X-JSON-Path']) && json_path =~ /\A\$(.(^[.\[\]])*(\[[0-9]+\])?)+\Z/
json_path = json_path.split('.')
json_path.shift
- 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 evolve
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def evolve(value)
if value.respond_to?(:orm_model) && value.respond_to?(:id)
value.id
else
case 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 _handle_error
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _handle_error(instance, err, property = :base)
return unless instance
msg = err.is_a?(String) ? err : err.message
if block_given?
msg = yield msg
- 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 chunking
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def chunking(io, chunk_size, &block)
if io.method(:read).arity.zero?
data = io.read
i = 0
loop do
- 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 parse_viewport
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_viewport(value)
value = value.to_s.split(' ').map do |seq|
seq.chars.inject([]) do |a, char|
case char
when '{', '}'
- 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_slug
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_slug
check_taken = true
unless slug.present?
candidate =
if (candidate = slug_candidate).blank?
Method run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(message)
data_type = data_type_from(message)
if data_type
if data_type.bulkable_deletable?
if (model = data_type.records_model)
Method data_type_schemas
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data_type_schemas(source, options = {})
options[:schemas] = schemas =
case source
when nil # All schemas
Setup::Schema.all
Method check_propertyNames
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_propertyNames(schema, instance, state, data_type, options)
path = options[:path] || '#'
schema = data_type.merge_schema(schema)
if instance.is_a?(Mongoff::Record)
unless state[:instance_clear]
Method to_json_schema
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_json_schema
json_schema = documenting('type' => 'object')
if name
json_schema['title'] = name.to_title
end
Method save
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save(record, options = {})
saved = options[:saved_collector] || Set.new
if bind_references(record, options.delete(:bind_references))
success =
if record.try(:save_self_before_refs)
Method to_map_schema
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_map_schema(sch)
if sch['type'] == 'object' && (properties = sch['properties']).is_a?(Hash)
new_properties = {}
id_optional = true
properties.each do |property, property_schema|
Method source_options
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def source_options(options, source_key_options = self.source_key_options)
data_type_key = source_key_options[:data_type_key] || :source_data_type
if (data_type = send(data_type_key) || options[data_type_key] || options[:data_type])
model = data_type.records_model
offset = options[:offset] || 0
Method new
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new
response = {}
%w(success warnings errors).each { |key| response[key.to_sym] = Hash.new { |h, k| h[k] = [] } }
@payload.each do |root, message|
if (data_type = @payload.data_type_for(root))
Method new
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new
if (provider = params[:with])
redirect_to "/app/#{::Cenit::OpenId.app_key}?with=#{provider}&redirect_uri=#{Cenit.homepage}#{session_path(resource_name)}"
elsif (code = params[:code])
if (user = ::Cenit::OpenId.get_user_by(code))
Method token
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def token
response = {}
response_code = :bad_request
errors = ''
token_class =
Method authorize_action
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authorize_action(options = {})
action = options[:action] || @_action_name
success = true
if klass
action_symbol =
Method check_dependentRequired
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_dependentRequired(properties, instance)
return unless instance
if instance.is_a?(Mongoff::Record)
has_errors = false
stored_properties = instance.orm_model.stored_properties_on(instance).map(&:to_s)
Method index
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if klass
@items =
if @criteria.present?
if (sort_key = @criteria.delete(:sort_by))
Method bundled_javascript_code
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bundled_javascript_code(algorithm)
arguments_param = false
i = -1
js_vars = ''
params_initializer =