Showing 19 of 32,162 total issues
Method active?
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def active?(digest) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
Sidekiq.redis do |conn|
procs = conn.sscan("processes").to_a
return false if procs.empty?
- Read upRead up
- Create a ticketCreate a ticket
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
Class Locksmith
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Locksmith # rubocop:disable Metrics/ClassLength
# includes "SidekiqUniqueJobs::Connection"
# @!parse include SidekiqUniqueJobs::Connection
include SidekiqUniqueJobs::Connection
- Create a ticketCreate a ticket
File app.js
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
(function() {
var localStorage = {}, sessionStorage = {};
try { localStorage = window.localStorage; } catch (e) { }
try { sessionStorage = window.sessionStorage; } catch (e) { }
- Create a ticketCreate a ticket
Method registered
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
app.helpers do
include Web::Helpers
end
- Create a ticketCreate a ticket
Class Lock
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Lock # rubocop:disable Metrics/ClassLength
# includes "SidekiqUniqueJobs::Connection"
# @!parse include SidekiqUniqueJobs::Connection
include SidekiqUniqueJobs::Connection
- Create a ticketCreate a ticket
Method orphans
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def orphans # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
orphans = []
page = 0
per = reaper_count * 2
results = digests.byscore(0, max_score, offset: page * per, count: (page + 1) * per)
- Read upRead up
- Create a ticketCreate a ticket
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
Function generateTOC
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateTOC() {
if ($('#filecontents').length === 0) return;
var _toc = $('<ol class="top"></ol>');
var show = false;
var toc = _toc;
- Create a ticketCreate a ticket
Function constantSummaryToggle
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function constantSummaryToggle() {
$('.constants_summary_toggle').click(function(e) {
e.preventDefault();
localStorage.summaryCollapsed = $(this).text();
$('.constants_summary_toggle').each(function() {
- Create a ticketCreate a ticket
Method after_unlock_hook
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def after_unlock_hook # rubocop:disable Metrics/MethodLength
lambda do
if @original_job_class.respond_to?(:after_unlock)
# instance method in sidekiq v6
if @original_job_class.method(:after_unlock).arity.positive? # arity check to maintain backwards compatibility
- Read upRead up
- Create a ticketCreate a ticket
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 create_v7_locks
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_v7_locks(num = 20) # rubocop:disable Metrics/MethodLength
old_digests = Array.new(num) { |n| "uniquejobs:v7-#{n}" }
Sidekiq.redis do |conn| # rubocop:disable Metrics/BlockLength
old_digests.each_slice(100) do |chunk|
conn.pipelined do |pipeline|
- Create a ticketCreate a ticket
Function summaryToggle
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function summaryToggle() {
$('.summary_toggle').click(function(e) {
e.preventDefault();
localStorage.summaryCollapsed = $(this).text();
$('.summary_toggle').each(function() {
- Create a ticketCreate a ticket
Method registered
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.registered(app) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
app.helpers do
include Web::Helpers
end
- Read upRead up
- Create a ticketCreate a ticket
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 constantize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def constantize(str)
return str.class if str.is_a?(Sidekiq::Job) # sidekiq v6.x
return str unless str.is_a?(String)
return Object.const_get(str) unless str.include?("::")
- Read upRead up
- Create a ticketCreate a ticket
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 enqueue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enqueue(conn)
queued_jid, elapsed = timed do
call_script(:queue, key.to_a, argv, conn)
end
- Read upRead up
- Create a ticketCreate a ticket
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 logging_context
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def logging_context
middleware = is_a?(SidekiqUniqueJobs::Middleware::Client) ? :client : :server
digest = item[LOCK_DIGEST]
lock_type = item[LOCK]
- Read upRead up
- Create a ticketCreate a ticket
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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute
synchronize do
if @running.false?
@running.make_true
schedule_next_task(@run_now ? 0 : @execution_interval)
- Read upRead up
- Create a ticketCreate a ticket
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 lock_args_method
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def lock_args_method
@lock_args_method ||= job_options.slice(LOCK_ARGS_METHOD, UNIQUE_ARGS_METHOD).values.first
@lock_args_method ||= :lock_args if job_method_defined?(:lock_args)
@lock_args_method ||= :unique_args if job_method_defined?(:unique_args)
@lock_args_method ||= default_lock_args_method
- Read upRead up
- Create a ticketCreate a ticket
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 scripts_path=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def scripts_path=(obj)
raise ArgumentError, "#{obj} should be a Pathname or String" unless obj.is_a?(Pathname) || obj.is_a?(String)
raise ArgumentError, "#{obj} does not exist" unless Dir.exist?(obj.to_s)
@scripts_path =
- Read upRead up
- Create a ticketCreate a ticket
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_by_digest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete_by_digest(digest, queuetime: true, runtime: true)
result, elapsed = timed do
call_script(
:delete_by_digest,
queuetime_keys(queuetime ? digest : nil) + runtime_keys(runtime ? digest : nil) + [key],
- Read upRead up
- Create a ticketCreate a ticket
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"