Skip to content

Commit 22fb6d6

Browse files
committed
feat: enable Naming/BlockForwarding and Style/ArgumentsForwarding rubocop rules
1 parent 711be26 commit 22fb6d6

File tree

18 files changed

+31
-32
lines changed

18 files changed

+31
-32
lines changed

.rubocop.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ Metrics/PerceivedComplexity:
3838
Naming/FileName:
3939
Exclude:
4040
- '**/opentelemetry-*'
41-
### TODO: Enable this is a separate PR
4241
Naming/BlockForwarding:
43-
Enabled: false
42+
Enabled: true
4443
Style/ArgumentsForwarding:
45-
Enabled: false
44+
Enabled: true
4645
#######################
4746
Style/Documentation:
4847
Exclude:

instrumentation/action_mailer/test/opentelemetry/instrumentation/action_mailer/subscription_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
end
117117
end
118118

119-
def with_configuration(values, &block)
119+
def with_configuration(values, &)
120120
original_config = instrumentation.instance_variable_get(:@config)
121121
modified_config = original_config.merge(values)
122122
instrumentation.instance_variable_set(:@config, modified_config)
@@ -126,14 +126,14 @@ def with_configuration(values, &block)
126126
instrumentation.instance_variable_set(:@config, original_config)
127127
end
128128

129-
def subscribing_to_deliver(&block)
129+
def subscribing_to_deliver(&)
130130
subscription = OpenTelemetry::Instrumentation::ActionMailer::Railtie.subscribe_to_deliver
131131
yield
132132
ensure
133133
ActiveSupport::Notifications.unsubscribe(subscription)
134134
end
135135

136-
def subscribing_to_process(&block)
136+
def subscribing_to_process(&)
137137
subscription = OpenTelemetry::Instrumentation::ActionMailer::Railtie.subscribe_to_process
138138
yield
139139
ensure

instrumentation/active_record/lib/opentelemetry/instrumentation/active_record/patches/persistence_class_methods.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class << base
1818

1919
# Contains ActiveRecord::Persistence::ClassMethods to be patched
2020
module ClassMethods
21-
def create(attributes = nil, &block)
21+
def create(attributes = nil, &)
2222
tracer.in_span("#{self}.create") do
2323
super
2424
end
2525
end
2626

27-
def create!(attributes = nil, &block)
27+
def create!(attributes = nil, &)
2828
tracer.in_span("#{self}.create!") do
2929
super
3030
end

instrumentation/active_record/lib/opentelemetry/instrumentation/active_record/patches/transactions_class_methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class << base
1818

1919
# Contains ActiveRecord::Transactions::ClassMethods to be patched
2020
module ClassMethods
21-
def transaction(**options, &block)
21+
def transaction(**options, &)
2222
tracer.in_span('ActiveRecord.transaction', attributes: { 'code.namespace' => name }) do
2323
super
2424
end

instrumentation/active_storage/test/opentelemetry/instrumentation/active_storage/subscription_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@
341341
# NOTE: The test for service_update_metadata.active_storage is skipped because this event is only for GCS service.
342342
# https://github.com/rails/rails/blob/fa9cf269191c5077de1abdd1e3f934fbeaf2a5d0/guides/source/active_support_instrumentation.md?plain=1#L928
343343

344-
def with_configuration(values, &block)
344+
def with_configuration(values, &)
345345
original_config = instrumentation.instance_variable_get(:@config)
346346
modified_config = original_config.merge(values)
347347
instrumentation.instance_variable_set(:@config, modified_config)
@@ -351,7 +351,7 @@ def with_configuration(values, &block)
351351
instrumentation.instance_variable_set(:@config, original_config)
352352
end
353353

354-
def with_subscription(&block)
354+
def with_subscription(&)
355355
OpenTelemetry::Instrumentation::ActiveStorage::Railtie.subscribe
356356
yield
357357
ensure

instrumentation/active_storage/test/test_helpers/test_previewer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def preview(**options)
2222

2323
private
2424

25-
def draw_sample_image(file, &block)
26-
draw 'echo', '"test previewer called"', &block
25+
def draw_sample_image(file, &)
26+
draw('echo', '"test previewer called"', &)
2727
end
2828
end

instrumentation/aws_sdk/lib/opentelemetry/instrumentation/aws_sdk/patches/telemetry.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def call(context)
1616

1717
private
1818

19-
def span_wrapper(context, &block)
19+
def span_wrapper(context, &)
2020
service_id = HandlerHelper.service_id(context)
2121
client_method = HandlerHelper.client_method(service_id, context)
2222
context.tracer.in_span(

instrumentation/bunny/lib/opentelemetry/instrumentation/bunny/patch_helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ module Bunny
1212
# For additional details around trace messaging semantics
1313
# See https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes
1414
module PatchHelpers
15-
def self.with_send_span(channel, tracer, exchange, routing_key, &block)
15+
def self.with_send_span(channel, tracer, exchange, routing_key, &)
1616
attributes = basic_attributes(channel, channel.connection, exchange, routing_key)
1717
destination = destination_name(exchange, routing_key)
1818

19-
tracer.in_span("#{destination} publish", attributes: attributes, kind: :producer, &block)
19+
tracer.in_span("#{destination} publish", attributes: attributes, kind: :producer, &)
2020
end
2121

2222
def self.with_process_span(channel, tracer, delivery_info, properties, &block)

instrumentation/concurrent_ruby/lib/opentelemetry/instrumentation/concurrent_ruby/patches/thread_pool_executor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Patches
1111
# Concurrent::ThreadPoolExecutor patch for instrumentation
1212
module ThreadPoolExecutor
1313
# @see Concurrent::ExecutorService#post
14-
def post(*args, **kwargs, &task)
14+
def post(*args, **kwargs, &)
1515
context = OpenTelemetry::Context.current
1616
return super unless context
1717

instrumentation/delayed_job/lib/opentelemetry/instrumentation/delayed_job/plugins/tracer_plugin.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Plugins
1313
# Delayed Job plugin that instruments invoke_job and other hooks
1414
class TracerPlugin < Delayed::Plugin
1515
class << self
16-
def instrument_enqueue(job, &block)
16+
def instrument_enqueue(job, &)
1717
return yield(job) unless enabled?
1818

1919
attributes = build_attributes(job)
@@ -27,7 +27,7 @@ def instrument_enqueue(job, &block)
2727
end
2828
end
2929

30-
def instrument_invoke(job, &block)
30+
def instrument_invoke(job, &)
3131
return yield(job) unless enabled?
3232

3333
attributes = build_attributes(job)

0 commit comments

Comments
 (0)