karafka/karafka

View on GitHub

Showing 112 of 150 total issues

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

Severity: Minor
Found in lib/karafka/pro/processing/strategies/lrj/ftr.rb - About 2 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 resolve_partitions_with_time_offsets has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def resolve_partitions_with_time_offsets
          time_tpl = Rdkafka::Consumer::TopicPartitionList.new

          # First we need to collect the time based once
          @expanded_topics.each do |name, partitions|
Severity: Minor
Found in lib/karafka/pro/iterator/tpl_builder.rb - About 2 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 handle_after_consume has a Cognitive Complexity of 15 (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/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 report_aggregated_topics_metrics has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

          def report_aggregated_topics_metrics(statistics, consumer_group_id)
            config.aggregated_rd_kafka_metrics.each do |metric|
              statistics.fetch('topics').each do |topic_name, topic_values|
                sum = 0

Severity: Minor
Found in lib/karafka/instrumentation/vendors/appsignal/metrics_listener.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 stop has a Cognitive Complexity of 15 (exceeds 5 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

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 15 (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_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 mark_as_consumed has a Cognitive Complexity of 15 (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, true)
              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 fetch_loop has 44 lines of code (exceeds 25 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 1 hr to fix

    Method resolve_partitions_with_negative_offsets has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

            def resolve_partitions_with_negative_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 find_all has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

            def find_all
              scopes = [Strategies]
              modules = Strategies.constants
    
              modules.each do |const|
    Severity: Minor
    Found in lib/karafka/pro/processing/strategy_selector.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 call has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def call
              # If no changes at all, just print and stop
              if topics_to_create.empty? && topics_to_repartition.empty? && topics_to_alter.empty?
                puts "Karafka will #{yellow('not')} perform any actions. No changes needed."
    
    
    Severity: Minor
    Found in lib/karafka/cli/topics/plan.rb - About 1 hr to fix

      Method topics_to_alter has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def topics_to_alter
                return @topics_to_alter if @topics_to_alter
      
                topics_to_check = []
      
      
      Severity: Minor
      Found in lib/karafka/cli/topics/plan.rb - About 1 hr to fix

        Method report_metric has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def report_metric(metric, statistics, base_tags)
                    case metric.scope
                    when :root
                      public_send(
                        metric.type,
        Severity: Minor
        Found in lib/karafka/instrumentation/vendors/datadog/metrics_listener.rb - About 1 hr to fix

          Method poll has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def poll(timeout)
                  time_poll ||= TimeTrackers::Poll.new(timeout)
          
                  return nil if time_poll.exceeded?
          
          
          Severity: Minor
          Found in lib/karafka/connection/client.rb - About 1 hr to fix

            Method each has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def each
                    Admin.with_consumer(@settings) do |consumer|
                      tpl = TplBuilder.new(consumer, @topics_with_partitions).call
                      consumer.assign(tpl)
            
            
            Severity: Minor
            Found in lib/karafka/pro/iterator.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 13 (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/ftr_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 handle_after_consume has a Cognitive Complexity of 13 (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_ftr_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 call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                    def call
                      # If no changes at all, just print and stop
                      if topics_to_create.empty? && topics_to_repartition.empty? && topics_to_alter.empty?
                        puts "Karafka will #{yellow('not')} perform any actions. No changes needed."
            
            
            Severity: Minor
            Found in lib/karafka/cli/topics/plan.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 13 (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/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 report_metric has 38 lines of code (exceeds 25 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
            Severity: Minor
            Found in lib/karafka/instrumentation/vendors/appsignal/metrics_listener.rb - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language