lib/sidekiq-scheduler/scheduler.rb
Class Scheduler
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Scheduler
# We expect rufus jobs to have #params
Rufus::Scheduler::Job.module_eval do
alias_method :params, :opts
end
Method load_schedule!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
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 load_schedule_job
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
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 new_job
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def new_job(name, interval_type, config, schedule, options)