Showing 829 of 829 total issues
Method check_string_format
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def check_string_format(format, instance)
case format
when 'date', 'date-time', 'time'
unless DATE_TIME_TYPES.any? { |type| instance.is_a?(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 new_user
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def new_user
data = (JSON.parse(@webhook_body) rescue {}).keep_if { |key, _| %w(email password password_confirmation token code).include?(key) }
data = data.with_indifferent_access
data.reverse_merge!(email: params[:email], password: pwd = params[:password], password_confirmation: params[:password_confirmation] || pwd)
status = :not_acceptable
- 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 find_record
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def find_record(conditions, *scopes)
scopes.each do |original_scope|
scope = original_scope
match_conditions = {}
begin
- 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 start_consumer
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def start_consumer
if init
new_rabbit_consumer = RabbitConsumer.create(channel: "#{connection.host}:#{connection.local_port} (#{channel.id})",
tag: channel.generate_consumer_tag(Cenit.rabbit_mq_queue))
new_consumer = queue.subscribe(consumer_tag: new_rabbit_consumer.tag, manual_ack: true) do |delivery_info, properties, body|
- 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 30 (exceeds 5 allowed). Consider refactoring. Open
def run(message)
message = message.with_indifferent_access
data_types =
case source = message[:source]
when nil # All data types
- 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 lookup_messages
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def lookup_messages(opts = {})
channel_mutex.lock
if channel && !channel.closed?
dispatched_ids = []
tenant_tasks = {}
- 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
File rabbit.rb
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'json'
require 'openssl'
require 'bunny'
module Cenit
Class User
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class User
include Setup::CenitUnscoped
include Cenit::MultiTenancy::UserScope
extend DeviseOverrides
include CredentialsGenerator
Consider simplifying this complex logical expression. Open
if schema.is_a?(Hash) && (schema = schema.reject { |key, _| %w(types contextual_params data filter group xml unique title description edi format example enum readOnly default visible referenced_by maxProperties minProperties auto export_embedded exclusive).include?(key) })
property_dt = nil
ns = data_type.namespace
if (ref = schema['$ref']).is_a?(Array)
ref = nil
Method prepare
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.prepare
return self if @init_done
@init_done = true
actions = Setup::Models.all.reduce(Set.new) do |set, model|
Method record_to_xml_element
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
def record_to_xml_element(data_type, schema, record, xml_doc, enclosed_property_name, options, namespaces)
return unless record
if Cenit::Utility.json_object?(record)
return Nokogiri::XML({ enclosed_property_name => record }.to_xml(dasherize: false)).root.first_element_child
end
Method process_connection
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def process_connection(template_parameters, verbose_response, last_response, options, &block)
conformed_url = template_parameters[:url]
conformed_path = template_parameters[:path]
body = template_parameters[:body]
halt_anyway = 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
File algorithm.rb
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rkelly'
module Setup
class Algorithm
include SnippetCode
Method validate_slug
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def validate_slug
check_taken = true
unless slug.present?
candidate =
if (candidate = slug_candidate).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 run
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def run(message)
if (hook = Cenit::Hook.where(id: message[:hook_id]).first)
slug = message[:slug]
if (hook_channel = hook.channels.where(slug: slug).first)
if (data_type = hook_channel.data_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 validate_data
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def validate_data(data)
case schema_type
when :json_schema
unless data.is_a?(Hash)
data =
- 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 new
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def new
parser_options = self.parser_options.dup
if klass.is_a?(Class) && klass < FieldsInspection
parser_options[:inspect_fields] = Account.current.nil? || !::User.super_access?
end
- 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 index
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def index
page = get_page
res =
if klass
@render_options.delete(:inspecting)
- 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 do_store
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def do_store(json, key, value, options, schema = {}, store_anyway = false)
if options[:nqnames]
key = key.to_s.split(':').last
end
if value.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 run
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def run(message)
if (data_type = agent_from_msg)
begin
config = data_type.file_store_config
total = data_type.all.count.to_f
- 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"