Showing 9 of 11 total issues
Class Scheduler
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Scheduler
# We expect rufus jobs to have #params
Rufus::Scheduler::Job.module_eval do
alias_method :params, :opts
end
Method set_current_scheduler_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_current_scheduler_options(config)
enabled = SidekiqScheduler::Scheduler.enabled
dynamic = SidekiqScheduler::Scheduler.dynamic
dynamic_every = SidekiqScheduler::Scheduler.dynamic_every
listened_queues_only = SidekiqScheduler::Scheduler.listened_queues_only
- 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 load_schedule!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def load_schedule!
if enabled
Sidekiq.logger.info 'Loading Schedule'
# Load schedule from redis for the first time if dynamic
- 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_using_old_sidekiq_scheduler_config!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.check_using_old_sidekiq_scheduler_config!(sidekiq_config)
%i[enabled dynamic dynamic_every schedule listened_queues_only rufus_scheduler_options].each do |option|
if SIDEKIQ_GTE_7_0_0
if sidekiq_config.key?(option)
raise OptionNotSupportedAnymore, ":#{option} option should be under the :scheduler: 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 load_schedule_job
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_schedule_job(name, config)
# If rails_env is set in the config, enforce ENV['RAILS_ENV'] as
# required for the jobs to be scheduled. If rails_env is missing, the
# job should be scheduled regardless of what ENV['RAILS_ENV'] is set
# to.
- 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 sidekiq_queues
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.sidekiq_queues(sidekiq_config)
if SIDEKIQ_GTE_7_0_0
if sidekiq_config.nil? || (sidekiq_config.respond_to?(:empty?) && sidekiq_config.empty?)
Sidekiq.instance_variable_get(:@config).queues.map(&:to_s)
else
- 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_job
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def new_job(name, interval_type, config, schedule, options)
Method symbolize_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.symbolize_keys(object)
if object.is_a?(Hash)
Hash[[*object.map { |k, v| [k.to_sym, symbolize_keys(v) ]} ]]
elsif object.is_a?(Array) || object.is_a?(Set)
- 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 stringify_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.stringify_keys(object)
if object.is_a?(Hash)
Hash[[*object.map { |k, v| [k.to_s, stringify_keys(v) ]} ]]
elsif object.is_a?(Array) || object.is_a?(Set)
- 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"