Showing 57 of 65 total issues
Method process_all
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def process_all
barrier = Async::Barrier.new
semaphore = Async::Semaphore.new(@max_concurrent_jobs, parent: barrier)
Worker.logger.info "Start processing all.."
- 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 delete_keys
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def delete_keys(redis_conn, services, log_deleted_keys)
cursor = 0
loop do
with_retries 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 do_authrep
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def do_authrep(method, provider_key, params, context_info)
request_info = context_info[:request] || {}
status = begin
validate(method == :oauth_authrep, provider_key, true, params, request_info)
rescue ApplicationNotFound => e
- 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_batch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_batch(list)
all = Hash.new
list.each do |item|
obj = decode(item)
Method update_alerts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_alerts(applications)
current_timestamp = Time.now.getutc
applications.each do |_appid, values|
service_id = values[:service_id]
- 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 to_xml
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(options = {})
xml = ''
xml << '<?xml version="1.0" encoding="UTF-8"?>'.freeze unless options[:skip_instruct]
xml << '<status>'.freeze
- 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 valid_encoding?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def valid_encoding?
self.each do |k, v|
return false if k.is_a?(String) && !k.valid_encoding?
if v.is_a?(String) || v.is_a?(Array) || v.is_a?(Hash)
return false unless v.valid_encoding?
- 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 cfg_sentinels_handler
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cfg_sentinels_handler(options)
# get role attr and remove from options
# will only be validated and included when sentinels are valid
role = options.delete :role
sentinels = options.delete :sentinels
Method define_metrics
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_metrics
Yabeda.configure do
group :apisonator_listener do
counter :response_codes do
comment 'Response codes'
Method with_app_id_from_params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def with_app_id_from_params(service_id, app_id, user_key)
if app_id
raise AuthenticationError unless user_key.nil?
elsif user_key
app_id = load_id_by_key(service_id, user_key)
- 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 aggregate_values
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def aggregate_values(value, timestamp, keys, cmd, client = storage)
keys_for_bucket = []
keys.each do |metric_type, prefix_key|
granularities(metric_type).each do |granularity|
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def self.run(rack)
rack.instance_eval do
use Rack::InternalErrorCatcher if Backend.production?
Backend::Logging::External.setup_rack self
- 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 perform_logged
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform_logged(service_id, raw_transactions, _enqueue_time, context_info = {})
context_info ||= {} # avoid nils potentially existing in older versions
request_info = context_info['request'.freeze] || {}
transactions = parse_transactions(service_id, raw_transactions, request_info)
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate(oauth, provider_key, report_usage, params, request_info)
service = Service.load_with_provider_key!(params[:service_id], provider_key)
oidc_service = !oauth && service.backend_version == 'oauth'.freeze
# service_id cannot be taken from params since it might be missing there
- 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 service_id
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def service_id
if params[:service_id].nil? || params[:service_id].empty?
@service_id ||= Service.default_id!(params[:provider_key])
else
unless Service.authenticate_service_id(params[:service_id], params[:provider_key])
- 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 work
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def work
register_worker
loop do
break if @shutdown
- 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_transactions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_transactions(service_id, raw_transactions, request_info)
transactions = []
exts = request_info['extensions'.freeze]&.symbolize_names || {}
group_by_application_id(service_id, raw_transactions) do |app_id, group|
- 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_non_unix_timestamp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_non_unix_timestamp(ts)
parts = Date._parse ts
if parts.has_key?(:year) && parts.has_key?(:mon) && parts.has_key?(:mday)
utc_time = Time.utc(parts[:year],
- 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
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate(oauth, provider_key, report_usage, params, request_info)
Method store_key
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def store_key(client, cmd, key, value, expire_time = nil)