kapost/circuitry

View on GitHub

Showing 5 of 5 total issues

Class Subscriber has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Subscriber
    include Concerns::Async
    include Services::SQS

    attr_reader :queue, :timeout, :wait_time, :batch_size, :lock
Severity: Minor
Found in lib/circuitry/subscriber.rb - About 2 hrs to fix

    Method subscribe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def subscribe(&block)
          raise ArgumentError, 'block required' if block.nil?
          raise SubscribeError, 'AWS configuration is not set' unless can_subscribe?
    
          logger.info("Subscribing to queue: #{queue}")
    Severity: Minor
    Found in lib/circuitry/subscriber.rb - About 25 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_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_message(message, &block)
          message = Message.new(message)
    
          logger.debug("Processing message #{message.id}")
    
    
    Severity: Minor
    Found in lib/circuitry/subscriber.rb - About 25 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 publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def publish(topic_name, object)
          raise ArgumentError, 'topic_name cannot be nil' if topic_name.nil?
          raise ArgumentError, 'object cannot be nil' if object.nil?
          raise PublishError, 'AWS configuration is not set' unless can_publish?
    
    
    Severity: Minor
    Found in lib/circuitry/publisher.rb - About 25 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 poll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def poll(&block)
          poller = Aws::SQS::QueuePoller.new(queue, client: sqs)
    
          poller.before_request do |_stats|
            throw :stop_polling unless subscribed?
    Severity: Minor
    Found in lib/circuitry/subscriber.rb - About 25 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