Showing 6 of 6 total issues
Method registered
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def self.registered(app)
# Allow method overrides to support RESTful deletes
app.set :method_override, true
- 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 registered
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.registered(app)
# Allow method overrides to support RESTful deletes
app.set :method_override, true
Method call
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def call(worker, msg, queue)
# Initial assignment to prevent SystemExit & co. from excepting
expiry = @expiration
- 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 call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call(worker_class, msg, queue, redis_pool=nil)
# Determine the actual job class
klass = msg["args"][0]["job_class"] || worker_class rescue worker_class
job_class = if klass.is_a?(Class)
- 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_and_unschedule
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def delete_and_unschedule(job_id, job_unix_time = nil)
Sidekiq.redis do |conn|
scan_options = {offset: 0, conn: conn, start: (job_unix_time || '-inf'), end: (job_unix_time || '+inf')}
while not (jobs = schedule_batch(scan_options)).empty?
- 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 display_args
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def display_args(msg, queue)
job = Sidekiq::Job.new(msg, queue)
return job.display_args.to_a.empty? ? nil : job.display_args.to_json
rescue Exception => e
# For Sidekiq ~> 2.7
- 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"