Showing 150 of 150 total issues
Method poll
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def poll(timeout)
time_poll ||= TimeTrackers::Poll.new(timeout)
return nil if time_poll.exceeded?
- 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 report_metric
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def report_metric(metric, statistics, base_tags)
case metric.scope
when :root
public_send(
metric.type,
- 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 report_metric
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def report_metric(metric, statistics, consumer_group_id)
case metric.scope
when :root
# Do nothing on the root metrics as the same metrics are reported in a granular
# way from other places
- 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 control
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def control
monitor.instrument('swarm.manager.control', caller: self) do
@nodes.each do |node|
statuses = @statuses[node]
- 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 scale_up
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def scale_up
multi_part_sgs_families = Karafka::App
.assignments
.select { |_, partitions| partitions.size > 1 }
.keys
- 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 scale_down
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def scale_down
sgs_in_use = Karafka::App.assignments.keys.map(&:subscription_group).uniq
# Select connections for scaling down
in_sg_families do |first_subscription_group, sg_listeners|
- 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
File attributes_map.rb
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Karafka
module Setup
# To simplify the overall design, in Karafka we define all the rdkafka settings in one scope
# under `kafka`. rdkafka though does not like when producer options are passed to the
# consumer configuration and issues warnings. This target map is used as a filtering layer, so
Class Client
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Client
attr_reader :rebalance_manager
# @return [Karafka::Routing::SubscriptionGroup] subscription group to which this client
# belongs to
Method build_and_schedule_periodic_jobs
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def build_and_schedule_periodic_jobs
# Shortcut if periodic jobs are not used at all. No need to run the complex flow when it
# will never end up with anything. If periodics on any of the topics are not even defined,
# we can finish fast
@periodic_jobs ||= @subscription_group.topics.count(&:periodic_job?)
- 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
File client.rb
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Karafka
# Namespace for Kafka connection related logic
module Connection
# An abstraction layer on top of the rdkafka consumer.
#
Method handle_after_consume
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def handle_after_consume
coordinator.on_finished do |last_group_message|
if coordinator.success?
coordinator.pause_tracker.reset
- 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 handle_after_consume
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def handle_after_consume
coordinator.on_finished do |last_group_message|
if coordinator.success?
coordinator.pause_tracker.reset
- 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
Class LoggerListener
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class LoggerListener
# Log levels that we use in this particular listener
USED_LOG_LEVELS = %i[
debug
info
Method handle_after_consume
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def handle_after_consume
coordinator.on_finished do |last_group_message|
if coordinator.success?
coordinator.pause_tracker.reset
- 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 batch_poll
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def batch_poll
time_poll = TimeTrackers::Poll.new(@subscription_group.max_wait_time)
@buffer.clear
@rebalance_manager.clear
- 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 handle_after_consume
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def handle_after_consume
coordinator.on_finished do |last_group_message|
if coordinator.success?
coordinator.pause_tracker.reset
- 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
Class BaseConsumer
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseConsumer
# Allow for consumer instance tagging for instrumentation
include ::Karafka::Core::Taggable
extend Forwardable
Method on_error_occurred
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_error_occurred(event)
type = event[:type]
error = event[:error]
details = (error.backtrace || []).join("\n")
Method handle_after_consume
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def handle_after_consume
coordinator.on_finished do |last_group_message|
if coordinator.success?
coordinator.pause_tracker.reset
- 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 topics_to_alter
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def topics_to_alter
return @topics_to_alter if @topics_to_alter
topics_to_check = []
- 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"