mxenabled/action_subscriber

View on GitHub

Showing 5 of 9 total issues

Method start_subscriber_for_subscription has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def start_subscriber_for_subscription(subscription)
        route = subscription[:route]
        queue = subscription[:queue]
        channel = queue.channel
        threadpool = ::ActionSubscriber::ThreadPools.threadpools.fetch(route.threadpool_name)
Severity: Minor
Found in lib/action_subscriber/bunny/subscriber.rb - About 1 hr to fix

    Method start_subscriber_for_subscription has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def start_subscriber_for_subscription(subscription)
            route = subscription[:route]
            queue = subscription[:queue]
            queue.channel.prefetch = route.prefetch if route.acknowledgements?
            threadpool = ::ActionSubscriber::ThreadPools.threadpools.fetch(route.threadpool_name)
    Severity: Minor
    Found in lib/action_subscriber/march_hare/subscriber.rb - About 1 hr to fix

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

          def _run_action_at_least_once_with_filters(env, action)
            processed_acknowledgement = false
            rejected_message = false
      
            _run_action_with_filters(env, action)
      Severity: Minor
      Found in lib/action_subscriber/dsl.rb - About 1 hr to fix

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

            def self.parse_amqp_url(connection_string)
              uri = ::URI.parse(connection_string)
              raise ArgumentError.new("Connection URI must use amqp or amqps schema (example: amqp://bus.megacorp.internal:5766), learn more at http://bit.ly/ks8MXK") unless %w{amqp amqps}.include?(uri.scheme)
        
              opts = {}
        Severity: Minor
        Found in lib/action_subscriber/uri.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 local_application_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def local_application_name(reload = false)
              if reload || @_local_application_name.nil?
                @_local_application_name = case
                                      when ENV['APP_NAME'] then
                                        ENV['APP_NAME'].to_s.dup
        Severity: Minor
        Found in lib/action_subscriber/subscribable.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