adHawk/hanami-events-cloud_pubsub

View on GitHub

Showing 44 of 45 total issues

Line is too long. [81/80]
Open

        # It is a last ditch effort to salvage resources and is used as a "damage

Line is too long. [94/80]
Open

events = Hanami::Events.initialize(:cloud_pubsub, pubsub: pubsub, logger: Logger.new($stdout))
Severity: Minor
Found in examples/client.rb by rubocop

Line is too long. [97/80]
Open

            0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, # standard (from Prometheus)

Line is too long. [82/80]
Open

            labels = { event_name: event_name, subscription: sub, status: status }

Line is too long. [88/80]
Open

          listener = subscription.listen(**subscriber_options) { |m| handle_message(m) }

Line is too long. [96/80]
Open

          raise Errors::NoSubscriberError, 'No subsriber has been registered' unless @subscriber

Line is too long. [109/80]
Open

          sub.dead_letter_topic = dead_letter_topic if sub.dead_letter_topic&.name != dead_letter_topic&.name

Line is too long. [88/80]
Open

            elapsed = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start).round(3)

Line is too long. [81/80]
Open

                   desc: 'Config file which is loaded before starting the runner'

Use attributes[:request_id] = ::RequestId.request_id || SecureRandom.uuid instead of attributes.merge!( request_id: ::RequestId.request_id || SecureRandom.uuid ).
Open

              attributes.merge!(
                request_id: ::RequestId.request_id || SecureRandom.uuid
              )

This cop identifies places where Hash#merge! can be replaced by Hash#[]=.

Example:

hash.merge!(a: 1)
hash.merge!({'key' => 'value'})
hash.merge!(a: 1, b: 2)

Line is too long. [84/80]
Open

                                           buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS

Line is too long. [85/80]
Open

            raise Errors::SubscriptionNotFoundError, "no subscription named: #{name}"

Line is too long. [84/80]
Open

        # waiting for messages to finish processing, etc. If this method succesfully

Line is too long. [86/80]
Open

            # requirements easily, so we take the old requirements and append 'events'

Line is too long. [93/80]
Open

          middleware.invoke(serialized_payload, **attrs, **message_opts) do |payload, **opts|

Line is too long. [82/80]
Open

              logger.warn "No config file found (tried #{@config}), using default"

Line is too long. [98/80]
Open

                opts = { pubsub: Google::Cloud::Pubsub.new, logger: Hanami::Components['logger'] }

Do not suppress exceptions.
Open

        rescue LoadError
Severity: Minor
Found in lib/hanami/events/cloud_pubsub.rb by rubocop

This cop checks for rescue blocks with no body.

Example:

# bad

def some_method
  do_something
rescue
  # do nothing
end

Example:

# bad

begin
  do_something
rescue
  # do nothing
end

Example:

# good

def some_method
  do_something
rescue
  handle_exception
end

Example:

# good

begin
  do_something
rescue
  handle_exception
end

Line is too long. [103/80]
Open

          sub.deadline = subscriber_options[:deadline] if sub.deadline != subscriber_options[:deadline]

Line is too long. [81/80]
Open

          CloudPubsub.logger.error e.backtrace.join("\n") unless e.backtrace.nil?
Severity
Category
Status
Source
Language