Showing 829 of 829 total issues
Method initialize
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(scope = '')
@openid = Set.new
@access = {}
@super_methods = Set.new
scope = scope.to_s.strip
Method mapping_schema
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mapping_schema(target_data_type_id = nil)
sch = {
SCHEMA_FLAG.to_s => true,
type: 'object',
properties: {
File control.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Cenit
class Control
include CanCan::Ability
attr_reader :app, :action, :controller
Method scan_dependencies_on
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def scan_dependencies_on(record, opts)
return false if opts[:visited].include?(record) || record.is_a?(Setup::CenitDataType)
opts[:visited] << record
record.class.reflect_on_all_associations(:embeds_one,
:embeds_many,
- 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 run
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run(message)
parser_options = (message['parser_options'] || {}).dup.with_indifferent_access
parser_options[:create_callback] = -> model {
unless authorize_action(action: :create, klass: model)
fail "Not authorized to create records of type #{model}"
- 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_embedded_schema
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_embedded_schema(ref, root_schema, root_name = '')
fail "invalid format for embedded reference #{ref}" unless ref =~ %r{\A#(\/[a-z]+(_|([0-9]|[a-z])+)*)*\Z}
fail "embedding itself (referencing '#')" if ref.eql?('#')
tokens = ref.split('/')
tokens.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 check_required
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def check_required(properties, instance)
return unless instance && properties.is_a?(Array)
if instance.is_a?(Mongoff::Record)
has_errors = false
stored_properties = instance.orm_model.stored_properties_on(instance)
- 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 mapping_schema
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mapping_schema(target_data_type_id = nil)
sch = {
SCHEMA_FLAG.to_s => true,
type: 'object',
properties: {
File json_data_type.rb
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Setup
class JsonDataType < DataType
include Setup::SnippetCode
origins Setup::CrossOriginShared::DEFAULT_ORIGINS
Method validates_mapping
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validates_mapping
mapping.validate
unless mapping.errors.present?
map_model.for_each_association do |a|
name = a[:name]
Method validates_mapping
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validates_mapping
mapping.validate
unless mapping.errors.present?
map_model.for_each_association do |a|
name = a[:name]
File account.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'cenit/heroku_client'
class Account
include Setup::CenitUnscoped
include Cenit::MultiTenancy
Method check_patternProperties
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_patternProperties(patterns, instance, state, data_type, options)
path = options[:path] || '#'
unless (checked_properties = state[:checked_properties])
checked_properties = state[:checked_properties] = Set.new
end
Consider simplifying this complex logical expression. Open
if source_key_options[:bulk]
{
source_key_options[:sources_key] || :sources =>
if (selector = options[:selector])
model.where(selector).to_enum
Class FileDataType
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class FileDataType < DataType
origins Setup::CrossOriginShared::DEFAULT_ORIGINS, :cenit
validates_presence_of :namespace
Method index
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
setup_viewport
items = select_items
if (distinct = params[:format]&.match(/\Adistinct\((.+)\)\Z/))
json = klass.collection.distinct(distinct[1], items.selector)
Method authorize_account
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authorize_account(soft = false)
account_backup = Account.current
user_backup = User.current
Account.current = User.current = error_description = nil
if (auth_header = request.headers['Authorization'])
Method authorize_account
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authorize_account
@authentication_method = nil
user = nil
# New key and token params.
Method cross_to
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def cross_to(origin = :default, criteria = {})
COLLECTING_PROPERTIES.each do |property|
r = reflect_on_association(property)
next unless (model = r.klass).include?(Setup::CrossOriginShared)
criteria = criteria.merge(:origin.ne => :default) if model == Setup::RemoteOauthClient || model == Setup::GenericAuthorizationClient
- 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 condition_apply
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def condition_apply(obj, before, field_name, condition)
obj_v = obj.try(field_name)
cond_v = valuate(condition['v'], obj_v.class)
obj_values =
if cond_v.is_a?(String) || (cond_v.is_a?(Array) && cond_v.detect { |e| e.is_a?(String) })
- 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"