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)

instrumentation/graphql/test/instrumentation/graphql/tracers/graphql_trace_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,32 +302,32 @@ def initialize(events:, **_options)
302302
super
303303
end
304304

305-
def platform_execute_field(platform_key, &block)
305+
def platform_execute_field(platform_key, &)
306306
@events << platform_key
307307
yield
308308
end
309309

310-
def platform_execute_field_lazy(platform_key, &block)
310+
def platform_execute_field_lazy(platform_key, &)
311311
@events << platform_key
312312
yield
313313
end
314314

315-
def platform_authorized(platform_key, &block)
315+
def platform_authorized(platform_key, &)
316316
@events << platform_key
317317
yield
318318
end
319319

320-
def platform_authorized_lazy(platform_key, &block)
320+
def platform_authorized_lazy(platform_key, &)
321321
@events << platform_key
322322
yield
323323
end
324324

325-
def platform_resolve_type(platform_key, &block)
325+
def platform_resolve_type(platform_key, &)
326326
@events << platform_key
327327
yield
328328
end
329329

330-
def platform_resolve_type_lazy(platform_key, &block)
330+
def platform_resolve_type_lazy(platform_key, &)
331331
@events << platform_key
332332
yield
333333
end

instrumentation/http_client/lib/opentelemetry/instrumentation/http_client/patches/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Client
1515

1616
private
1717

18-
def do_get_block(req, proxy, conn, &block)
18+
def do_get_block(req, proxy, conn, &)
1919
uri = req.header.request_uri
2020
url = "#{uri.scheme}://#{uri.host}"
2121
request_method = req.header.request_method

instrumentation/koala/lib/opentelemetry/instrumentation/koala/patches/instrumentation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Koala
1010
module Patches
1111
# Module to prepend to Koala::Facebook::API for instrumentation
1212
module Api
13-
def graph_call(path, args = {}, verb = 'get', options = {}, &post_processing)
13+
def graph_call(path, args = {}, verb = 'get', options = {}, &)
1414
OpenTelemetry::Common::HTTP::ClientContext.with_attributes('peer.service' => 'facebook', 'koala.verb' => verb, 'koala.path' => path) do
1515
super
1616
end

instrumentation/net_http/lib/opentelemetry/instrumentation/net/http/patches/instrumentation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Instrumentation
1717
# Constant for the HTTP status range
1818
HTTP_STATUS_SUCCESS_RANGE = (100..399)
1919

20-
def request(req, body = nil, &block)
20+
def request(req, body = nil, &)
2121
# Do not trace recursive call for starting the connection
2222
return super unless started?
2323

instrumentation/que/lib/opentelemetry/instrumentation/que/middlewares/server_middleware.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Que
1010
module Middlewares
1111
# Server middleware to trace Que jobs
1212
class ServerMiddleware
13-
def self.call(job, &block)
13+
def self.call(job, &)
1414
job_class = job_class(job)
1515
span_name = "#{job_class} process"
1616
attributes = attributes_before_job_completion(job, job_class)

instrumentation/que/lib/opentelemetry/instrumentation/que/patches/que_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def gem_version
6262
end
6363

6464
if Gem.loaded_specs['que'].version >= Gem::Version.new('2.1.0')
65-
def bulk_enqueue(**_kwargs, &block)
65+
def bulk_enqueue(**_kwargs, &)
6666
tracer = Que::Instrumentation.instance.tracer
6767
otel_config = Que::Instrumentation.instance.config
6868

instrumentation/restclient/lib/opentelemetry/instrumentation/restclient/patches/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Request
1313
# Constant for the HTTP status range
1414
HTTP_STATUS_SUCCESS_RANGE = (100..399)
1515

16-
def execute(&block)
16+
def execute(&)
1717
trace_request do |_span|
1818
super
1919
end

instrumentation/rspec/test/rspec_patches.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
module RSpec
77
module Core
88
module DSL
9-
def self.change_global_dsl(&blk)
9+
def self.change_global_dsl(&)
1010
nil
1111
end
1212
end

0 commit comments

Comments
 (0)