karafka/karafka

View on GitHub

Showing 112 of 152 total issues

Method stop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def stop
        # Ensure that the stopping procedure is initialized only once
        @mutex.synchronize do
          return if @stopping

Severity: Minor
Found in lib/karafka/swarm/supervisor.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

Method resume has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def resume
        @pauses.each do |topic, partitions|
          partitions.each do |partition, pause|
            next unless pause.paused?
            next unless pause.expired?
Severity: Minor
Found in lib/karafka/connection/pauses_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

Method pop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def pop(timeout: 10_000_000_000)
        deadline = monotonic_now + timeout * 1000

        @mutex.synchronize do
          loop do
Severity: Minor
Found in lib/karafka/processing/timed_queue.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

Method handle_after_consume has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

            def handle_after_consume
              coordinator.on_finished do |last_group_message|
                if coordinator.success?
                  coordinator.pause_tracker.reset

Severity: Minor
Found in lib/karafka/pro/processing/strategies/aj/dlq_mom_vp.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

Method prepended_module has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

          def prepended_module
            scope = @scope

            Module.new do
              # Runs validations related to this feature on a routing resources
Severity: Minor
Found in lib/karafka/routing/features/base/expander.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

Method resolve_partitions_with_exact_offsets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def resolve_partitions_with_exact_offsets
          @expanded_topics.each do |name, partitions|
            next unless partitions.is_a?(Hash)

            partitions.each do |partition, offset|
Severity: Minor
Found in lib/karafka/pro/iterator/tpl_builder.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

Method build_resources_to_migrate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def build_resources_to_migrate
          # We build non-fetched topics resources representations for further altering
          resources = candidate_topics.map do |topic|
            Admin::Configs::Resource.new(type: :topic, name: topic.name)
          end
Severity: Minor
Found in lib/karafka/cli/topics/align.rb - About 1 hr to fix

    Method build_and_schedule_flow_jobs has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def build_and_schedule_flow_jobs
            return if @messages_buffer.empty?
    
            consume_jobs = []
            idle_jobs = []
    Severity: Minor
    Found in lib/karafka/connection/listener.rb - About 1 hr to fix

      Method handle_after_consume has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

                  def handle_after_consume
                    coordinator.on_finished do
                      return if revoked?
      
                      if coordinator.success?
      Severity: Minor
      Found in lib/karafka/pro/processing/strategies/aj/dlq_mom.rb - About 55 mins 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 process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def process
              job = @jobs_queue.pop
      
              instrument_details = { caller: self, job: job, jobs_queue: @jobs_queue }
      
      
      Severity: Minor
      Found in lib/karafka/processing/worker.rb - About 55 mins 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 handle_after_consume has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

                  def handle_after_consume
                    coordinator.on_finished do
                      return if revoked?
      
                      if coordinator.success?
      Severity: Minor
      Found in lib/karafka/pro/processing/strategies/dlq/mom.rb - About 55 mins 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 resolve_partitions_with_cg_expectations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def resolve_partitions_with_cg_expectations
                tpl = Rdkafka::Consumer::TopicPartitionList.new
      
                # First iterate over all topics that we want to expand
                @expanded_topics.each do |name, partitions|
      Severity: Minor
      Found in lib/karafka/pro/iterator/tpl_builder.rb - About 55 mins 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 resume has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def resume(topic, partition)
              @mutex.synchronize do
                return if @closed
      
                # We now commit offsets on rebalances, thus we can do it async just to make sure
      Severity: Minor
      Found in lib/karafka/connection/client.rb - About 55 mins 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 with_broker_errors_retry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def with_broker_errors_retry(max_attempts:, wait_time: 1, errors: RETRYABLE_DEFAULT_ERRORS)
              attempt ||= 0
              attempt += 1
      
              yield
      Severity: Minor
      Found in lib/karafka/connection/proxy.rb - About 45 mins 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 alive? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def alive?
              @pidfd_select ||= [@pidfd_io]
      
              if @mutex.owned?
                return false if @cleaned
      Severity: Minor
      Found in lib/karafka/swarm/pidfd.rb - About 45 mins 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 pause has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def pause(topic, partition, offset = nil)
              @mutex.synchronize do
                # Do not pause if the client got closed, would not change anything
                return if @closed
      
      
      Severity: Minor
      Found in lib/karafka/connection/client.rb - About 45 mins 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 merge_kafka_defaults! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def merge_kafka_defaults!(config)
                KAFKA_DEFAULTS.each do |key, value|
                  next if config.kafka.key?(key)
      
                  config.kafka[key] = value
      Severity: Minor
      Found in lib/karafka/setup/config.rb - About 45 mins 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 fetch_loop has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def fetch_loop
              running!
              # Run the initial events fetch to improve chances of having metrics and initial callbacks
              # triggers on start.
              #
      Severity: Minor
      Found in lib/karafka/connection/listener.rb - About 45 mins 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 topics_to_repartition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def topics_to_repartition
                return @topics_to_repartition if @topics_to_repartition
      
                @topics_to_repartition = []
      
      
      Severity: Minor
      Found in lib/karafka/cli/topics/plan.rb - About 45 mins 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 handle_after_consume has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                  def handle_after_consume
                    coordinator.on_finished do |last_group_message|
                      return if revoked?
      
                      if coordinator.success?
      Severity: Minor
      Found in lib/karafka/pro/processing/strategies/dlq/ftr.rb - About 45 mins 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

      Severity
      Category
      Status
      Source
      Language