karafka/karafka

View on GitHub

Showing 112 of 150 total issues

Method on_error_occurred has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def on_error_occurred(event)
            push_tags

            error = event[:error]
            client.active_span&.set_error(error)
Severity: Minor
Found in lib/karafka/instrumentation/vendors/datadog/logger_listener.rb - About 1 hr to fix

    Method handle_after_consume has a Cognitive Complexity of 12 (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/aj/dlq_ftr_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 handle_after_consume has a Cognitive Complexity of 12 (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_ftr_mom.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 declaratives_routing_topics has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

            def declaratives_routing_topics
              return @declaratives_routing_topics if @declaratives_routing_topics
    
              collected_topics = {}
              default_servers = kafka_config[:'bootstrap.servers']
    Severity: Minor
    Found in lib/karafka/cli/topics/base.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 validate! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

                  def validate!(builder)
                    nodes_setup = Hash.new do |h, node_id|
                      h[node_id] = { active: false, node_id: node_id }
                    end
    
    
    Severity: Minor
    Found in lib/karafka/pro/routing/features/swarm/contracts/routing.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 12 (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/ftr_mom.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 a Cognitive Complexity of 12 (exceeds 5 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

    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_consumer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def build_consumer
            ::Rdkafka::Config.logger = ::Karafka::App.config.logger
    
            # We need to refresh the setup of this subscription group in case we started running in a
            # swarm. The initial configuration for validation comes from the parent node, but it needs
    Severity: Minor
    Found in lib/karafka/connection/client.rb - About 1 hr to fix

      Method stop has 33 lines of code (exceeds 25 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

        Method handle_after_consume has a Cognitive Complexity of 11 (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/lrj/mom.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 mark_as_consumed! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                    def mark_as_consumed!(message, offset_metadata = @_current_offset_metadata)
                      if @_in_transaction && !collapsed?
                        mark_in_transaction(message, offset_metadata, false)
                      elsif collapsed?
                        super
        Severity: Minor
        Found in lib/karafka/pro/processing/strategies/vp/default.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 11 (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/lrj_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 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

        Method mark_as_consumed has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                  def mark_as_consumed(message, offset_metadata = @_current_offset_metadata)
                    if @_in_transaction
                      mark_in_transaction(message, offset_metadata, true)
                    else
                      # seek offset can be nil only in case `#seek` was invoked with offset reset request
        Severity: Minor
        Found in lib/karafka/pro/processing/strategies/default.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 mark_as_consumed! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                  def mark_as_consumed!(message, offset_metadata = @_current_offset_metadata)
                    if @_in_transaction
                      mark_in_transaction(message, offset_metadata, false)
                    else
                      # seek offset can be nil only in case `#seek` was invoked with offset reset request
        Severity: Minor
        Found in lib/karafka/pro/processing/strategies/default.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 11 (exceeds 5 allowed). Consider refactoring.
        Open

                    def handle_after_consume
                      coordinator.on_finished do
                        if coordinator.success?
                          coordinator.pause_tracker.reset
        
        
        Severity: Minor
        Found in lib/karafka/pro/processing/strategies/aj/dlq_lrj_mom.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_post_filtering has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    def handle_post_filtering
                      filter = coordinator.filter
        
                      # We pick the timeout before the action because every action takes time. This time
                      # may then mean we end up having throttle time equal to zero when pause is needed
        Severity: Minor
        Found in lib/karafka/pro/processing/strategies/ftr/default.rb - About 1 hr to fix

          Method stop has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def stop
                  # Initialize the stopping process only if Karafka was running
                  return if Karafka::App.stopping?
                  return if Karafka::App.stopped?
                  return if Karafka::App.terminated?
          Severity: Minor
          Found in lib/karafka/server.rb - About 1 hr to fix

            Method process has 29 lines of code (exceeds 25 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 1 hr to fix

              Method run has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def run
                      # Close producer just in case. While it should not be used, we do not want even a
                      # theoretical case since librdkafka is not thread-safe.
                      # We close it prior to forking just to make sure, there is no issue with initialized
                      # producer (should not be initialized but just in case)
              Severity: Minor
              Found in lib/karafka/swarm/supervisor.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language