Showing 829 of 829 total issues
Method authorize_action
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def authorize_action(options = {})
success = true
if klass
action_symbol =
case @_action_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 push
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def push
response =
{
success: success_report = Hash.new { |h, k| h[k] = [] },
errors: broken_report = Hash.new { |h, k| h[k] = [] }
- 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_hash
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def evolve_hash(hash)
if (association = model.associations[field]) && association.referenced?
operators = {}
sub_criteria = {}
hash.each do |key, 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 json_object?
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def json_object?(obj, options = {})
case obj
when Hash
if options[:recursive]
obj.keys.each { |k| return false unless k.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"
Further reading
Method prepare_options
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def prepare_options(options)
include_id = options[:include_id]
[:ignore, :only, :embedding, :inspecting, :including].each do |option|
value = (options[option] || [])
value = [value] unless value.is_a?(Enumerable)
- 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 translate_export
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def translate_export(message, &block)
limit = translator.try(:bulk_source) ? lot_size || 1000 : 1
source_scope = sources(message)
max = source_scope.count - 1
translation_options = nil
Method execute
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(options = {})
task_desc = description.presence || "Task ##{id}"
if running? || !Cenit::Locker.lock(self)
notify(message: "Executing task ##{id} at #{Time.now} but it is already running")
else
Method check_properties
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_properties(json_schema, options = {})
object_schema =
case json_schema['type']
when 'object'
json_schema
Class DelayedMessage
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class DelayedMessage
include CenitUnscoped
deny :all
Class Algorithm
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Algorithm
include SnippetCode
include NamespaceNamed
include Taggable
# = Algorithm
Class CrossSharedCollection
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class CrossSharedCollection
include CenitUnscoped
include CrossOrigin::CenitDocument
include CollectionBehavior
include Taggable
Class OauthScope
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class OauthScope
AUTH_TOKEN = :auth
SESSION_ACCESS_TOKEN = :session_access
Method process_message
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_message(message, options = {})
unless message.is_a?(Hash)
message =
begin
JSON.parse(message)
Method authorize_action
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def authorize_action(options = {})
action = options[:action] || @_action_name
success = true
if klass
action_symbol =
- 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 update
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def update
@payload.each do |_, message|
message = message.first if message.is_a?(Array)
@parser_options[:add_only] = true
@item.send(@payload.update_method, message, @parser_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 mongo_type_for
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def mongo_type_for(field, schema, property_model = nil)
property_model ||= property_model(field) if field
schema ||= property_schema(field)
if property_model && schema['referenced']
property_model.mongo_type_for(:_id, nil) #TODO Set schema parameter default to 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 edi_value
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def edi_value(record, property_name, property_schema, property_model, options)
if (value = record[property_name]).nil?
value = property_schema['default'] || ''
end
value = property_model.to_string(value) if property_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 callback
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def callback
redirect_uri = nil
error = params[:error]
if (cenit_token = CallbackAuthorizationToken.where(token: params[:state] || session[:oauth_state]).first) &&
(User.current = cenit_token.set_current_tenant!.owner) && (auth = cenit_token.authorization)
Method pull
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pull(shared_collection, pull_request = {})
pull_request = pull_request.with_indifferent_access
pull_request = pull_request(shared_collection, pull_request) if pull_request[:pull_data].nil?
errors = []
if pull_request[:missing_parameters].blank?
Method enqueue
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enqueue(message, &block)
message = message.with_indifferent_access
task_description = message[:task_description]
auto_retry = message[:auto_retry].presence || Setup::Task.auto_retry_enum.first
scheduler = message.delete(:scheduler)