Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout/EmptyLinesAroundBlockBody-20230518233252 #207

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 180`
# on 2023-04-20 23:33:11 UTC using RuboCop version 1.50.2.
# on 2023-05-18 23:33:13 UTC using RuboCop version 1.51.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 53
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'lib/dispatch-rider/callbacks/storage.rb'
- 'lib/dispatch-rider/demultiplexer.rb'
- 'lib/dispatch-rider/integrations/appsignal.rb'
- 'spec/lib/dispatch-rider/airbrake_error_handler_spec.rb'
- 'spec/lib/dispatch-rider/configuration_spec.rb'
- 'spec/lib/dispatch-rider/default_error_handler_spec.rb'
- 'spec/lib/dispatch-rider/demultiplexer_spec.rb'
- 'spec/lib/dispatch-rider/dispatcher_spec.rb'
- 'spec/lib/dispatch-rider/publisher/base_spec.rb'
- 'spec/lib/dispatch-rider/publisher/configuration/notification_service_spec.rb'
- 'spec/lib/dispatch-rider/publisher/configuration_reader_spec.rb'
- 'spec/lib/dispatch-rider/publisher/configuration_spec.rb'
- 'spec/lib/dispatch-rider/publisher/configuration_support_spec.rb'
- 'spec/lib/dispatch-rider/publisher_spec.rb'
- 'spec/lib/dispatch-rider/queue_services/aws_sqs_spec.rb'
- 'spec/lib/dispatch-rider/queue_services/received_message_spec.rb'
- 'spec/lib/dispatch-rider/runner_spec.rb'
- 'spec/lib/dispatch-rider/subscriber_spec.rb'
- 'spec/lib/dispatch-rider_spec.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
Expand Down
2 changes: 0 additions & 2 deletions lib/dispatch-rider/callbacks/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ def before(event, block_param = nil, &block)
# @param [Proc] &block
def after(event, block_param = nil, &block)
around(event) do |job, *args|

job.call
ensure
(block_param || block).call(*args)

end
end

Expand Down
2 changes: 0 additions & 2 deletions lib/dispatch-rider/demultiplexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ def initialize(queue, dispatcher, error_handler)

def start
do_loop do

sleep 1
handle_next_queue_item
rescue => exception
error_handler.call(Message.new(subject: "TopLevelError", body: {}), exception)
throw :done

end
self
end
Expand Down
2 changes: 0 additions & 2 deletions lib/dispatch-rider/integrations/appsignal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ def self.wrap_message(job, message)
end

DispatchRider.configure do |config|

config.around(:dispatch_message) do |job, message|
DispatchRider::Integrations::Appsignal.wrap_message(job, message)
end

end

end
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider/airbrake_error_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require "spec_helper"

describe DispatchRider::AirbrakeErrorHandler do

describe ".call" do
let(:message) { DispatchRider::Message.new(subject: "TestMessage", body: "foo") }
let(:exception) { Exception.new("Something went terribly wrong") }
Expand All @@ -21,5 +20,4 @@
described_class.call(message, exception)
end
end

end
3 changes: 0 additions & 3 deletions spec/lib/dispatch-rider/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::Configuration do

subject { described_class.new }

describe "defaults" do
Expand Down Expand Up @@ -54,7 +53,6 @@
end

describe "#logger" do

describe "default" do
example { expect(subject.logger).to be_a(Logger) }
end
Expand All @@ -72,5 +70,4 @@
expect(subject.logger).to eq new_logger
end
end

end
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider/default_error_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require "spec_helper"

describe DispatchRider::DefaultErrorHandler do

describe ".call" do
let(:exception) { Exception.new("Something went terribly wrong") }

Expand All @@ -13,5 +12,4 @@
}.to raise_exception exception
end
end

end
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider/demultiplexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def process(options)
end

context "when the queue is not empty" do

before do
queue.push message
end
Expand Down Expand Up @@ -115,5 +114,4 @@ def process(options)
expect(demultiplexer_thread).not_to be_alive # looper should close the loop
end
end

end
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider/dispatcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ def process(_params)
before do
allow(DispatchRider.config).to receive(:callbacks) { storage }
storage.around(:dispatch_message) do |block, message|

dummy.before
dummy.log(message)
block.call
ensure
dummy.after

end
subject.register('handle_something')
end
Expand Down
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider/publisher/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::Publisher::Base do

class DummyPublisher < DispatchRider::Publisher::Base
destinations %i[sns_message_queue file_system_queue]
subject "Loud Cheering"
Expand Down Expand Up @@ -77,5 +76,4 @@ def self.publish(body, publisher)
end
end
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::Publisher::Configuration::NotificationService do

subject { described_class.new("file_system", options) }

let(:options) do
Expand Down Expand Up @@ -59,5 +58,4 @@
it { is_expected.not_to eq other }
end
end

end
13 changes: 0 additions & 13 deletions spec/lib/dispatch-rider/publisher/configuration_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
require 'spec_helper'

describe DispatchRider::Publisher::ConfigurationReader do

let :publisher do
double(:publisher)
end

describe ".load_config" do

subject { described_class }

it "responds to :load_config" do
Expand All @@ -29,11 +27,9 @@
end

describe "notification_services parsing" do

let(:configuration) { DispatchRider::Publisher::Configuration.new(configuration_hash) }

context "when notification_services has no items in it" do

let :configuration_hash do
{
notification_services: {}
Expand Down Expand Up @@ -86,15 +82,12 @@
subject.load_config(configuration, publisher)
end
end

end

describe "destinations" do

let(:configuration) { DispatchRider::Publisher::Configuration.new(configuration_hash) }

context "when destinations has no items in it" do

let :configuration_hash do
{
destinations: {}
Expand All @@ -105,11 +98,9 @@
expect(publisher).not_to receive(:register_destination)
subject.load_config(configuration, publisher)
end

end

context "when destinations has items in it" do

let :configuration_hash do
{
destinations: {
Expand All @@ -129,11 +120,7 @@
expect(publisher).to receive(:register_destination).once.with(*params)
subject.load_config(configuration, publisher)
end

end

end

end # .load_config

end
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider/publisher/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::Publisher::Configuration do

subject { described_class.new(configuration_hash) }

let(:configuration_hash) do
Expand Down Expand Up @@ -147,5 +146,4 @@
expect(subject.destinations).to match_array([destination])
end
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::Publisher::ConfigurationSupport do

subject { Object.new.extend(described_class) }

describe ".configuration" do
Expand Down Expand Up @@ -87,5 +86,4 @@
end
end
end

end
3 changes: 0 additions & 3 deletions spec/lib/dispatch-rider/publisher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::Publisher do

subject(:publisher) { described_class.new }

describe "#initialize" do
Expand Down Expand Up @@ -109,12 +108,10 @@
end

around do |ex|

DispatchRider.config.debug = true
ex.call
ensure
DispatchRider.config.debug = false

end

it "publishes the message to the notification service" do
Expand Down
5 changes: 0 additions & 5 deletions spec/lib/dispatch-rider/queue_services/aws_sqs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::QueueServices::AwsSqs do

subject(:aws_sqs_queue) do
described_class.new(:name => "normal_priority")
end
Expand All @@ -22,9 +21,7 @@
end

describe "#assign_storage" do

context "when the aws gem is installed" do

context "when the name of the queue is passed in the options" do
it "should return an instance representing the aws sqs queue" do
aws_sqs_queue.assign_storage(:name => 'normal_priority')
Expand Down Expand Up @@ -101,7 +98,6 @@
}.to raise_exception(/message: foo,.+ took .+ seconds while the timeout was 1/)
end
end

end

context "when the sqs queue is empty" do
Expand All @@ -115,7 +111,6 @@
}.not_to yield_control
end
end

end

describe "received message methods" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::QueueServices::ReceivedMessage do

subject { described_class.new("test_message", double(:item)) }

describe "#extend_timeout" do
Expand All @@ -21,5 +20,4 @@
}.to raise_error NotImplementedError
end
end

end
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider::Runner do

describe ".run" do
let(:subscriber) { double(:subscriber) }

Expand All @@ -27,5 +26,4 @@
described_class.run
end
end

end
1 change: 0 additions & 1 deletion spec/lib/dispatch-rider/subscriber_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,4 @@ def process(_options)
end
end
end

end
2 changes: 0 additions & 2 deletions spec/lib/dispatch-rider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'spec_helper'

describe DispatchRider do

describe ".configuration" do
example do
expect(described_class.configuration).to be_a(DispatchRider::Configuration)
Expand All @@ -25,5 +24,4 @@
expect(described_class.config.queue_kind).to eq(:test_queue)
end
end

end