bpot/poseidon

View on GitHub
lib/poseidon/partition_consumer.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

    def fetch(options = {})
      fetch_max_wait = options.delete(:max_wait_ms) || max_wait_ms
      fetch_max_bytes = options.delete(:max_bytes) || max_bytes
      fetch_min_bytes = options.delete(:min_bytes) || min_bytes

Severity: Minor
Found in lib/poseidon/partition_consumer.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 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def fetch(options = {})
      fetch_max_wait = options.delete(:max_wait_ms) || max_wait_ms
      fetch_max_bytes = options.delete(:max_bytes) || max_bytes
      fetch_min_bytes = options.delete(:min_bytes) || min_bytes

Severity: Minor
Found in lib/poseidon/partition_consumer.rb - About 1 hr to fix

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

        def resolve_offset_if_necessary
          return unless Symbol === @offset || @offset < 0
    
          protocol_offset = case @offset
          when :earliest_offset
    Severity: Minor
    Found in lib/poseidon/partition_consumer.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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(client_id, host, port, topic, partition, offset, options = {})
    Severity: Major
    Found in lib/poseidon/partition_consumer.rb - About 50 mins to fix

      Method consumer_for_partition has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.consumer_for_partition(client_id, seed_brokers, topic, partition, offset, options = {})
      Severity: Minor
      Found in lib/poseidon/partition_consumer.rb - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status