karafka/karafka

View on GitHub
lib/karafka/pro/connection/manager.rb

Summary

Maintainability
C
1 day
Test Coverage

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
Severity: Minor
Found in lib/karafka/pro/connection/manager.rb - About 3 hrs to fix

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|
Severity: Minor
Found in lib/karafka/pro/connection/manager.rb - About 3 hrs to fix

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 shutdown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def shutdown
          active_listeners = @listeners.active

          # When we are done processing immediately quiet all the listeners so they do not pick up
          # new work to do
Severity: Minor
Found in lib/karafka/pro/connection/manager.rb - About 1 hr to fix

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

There are no issues that match your filters.

Category
Status