From 4479b16dc82ae6b7bcec996f9c1a528d4aecea32 Mon Sep 17 00:00:00 2001 From: Kayla Reopelle Date: Wed, 22 Nov 2023 12:45:14 -0800 Subject: [PATCH] Unsafe Rubocop updates --- instrumentation/all/Gemfile | 2 +- .../instrumentation/delayed_job/plugins/tracer_plugin.rb | 2 ++ .../httpx/lib/opentelemetry/instrumentation/httpx/plugin.rb | 2 +- .../opentelemetry/instrumentation/mongo/command_serializer.rb | 2 +- .../rspec/lib/opentelemetry/instrumentation/rspec/formatter.rb | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/instrumentation/all/Gemfile b/instrumentation/all/Gemfile index 4ef786f4f7..5cfaa5c0be 100644 --- a/instrumentation/all/Gemfile +++ b/instrumentation/all/Gemfile @@ -11,7 +11,7 @@ gemspec group :test do Dir.entries('../') .select { |entry| File.directory?(File.join('../', entry)) } - .reject { |entry| %w[. .. all].include?(entry) } + .reject { |entry| %w[. .. all].include?(entry) } # rubocop:disable Performance/CollectionLiteralInLoop .sort .each { |dir| gem "opentelemetry-instrumentation-#{dir}", path: "../#{dir}" } end diff --git a/instrumentation/delayed_job/lib/opentelemetry/instrumentation/delayed_job/plugins/tracer_plugin.rb b/instrumentation/delayed_job/lib/opentelemetry/instrumentation/delayed_job/plugins/tracer_plugin.rb index 1558a933f9..676f720ed3 100644 --- a/instrumentation/delayed_job/lib/opentelemetry/instrumentation/delayed_job/plugins/tracer_plugin.rb +++ b/instrumentation/delayed_job/lib/opentelemetry/instrumentation/delayed_job/plugins/tracer_plugin.rb @@ -83,8 +83,10 @@ def job_queue(job) end callbacks do |lifecycle| + # rubocop:disable Performance/MethodObjectAsBlock lifecycle.around(:enqueue, &method(:instrument_enqueue)) lifecycle.around(:invoke_job, &method(:instrument_invoke)) + # rubocop:enable Performance/MethodObjectAsBlock end end end diff --git a/instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/plugin.rb b/instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/plugin.rb index bd17f6f928..137fca9766 100644 --- a/instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/plugin.rb +++ b/instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/plugin.rb @@ -16,7 +16,7 @@ def initialize(request) end def call - @request.on(:response, &method(:finish)) + @request.on(:response, &method(:finish)) # rubocop:disable Performance/MethodObjectAsBlock uri = @request.uri request_method = @request.verb diff --git a/instrumentation/mongo/lib/opentelemetry/instrumentation/mongo/command_serializer.rb b/instrumentation/mongo/lib/opentelemetry/instrumentation/mongo/command_serializer.rb index 3d3c217e6d..3696c102fa 100644 --- a/instrumentation/mongo/lib/opentelemetry/instrumentation/mongo/command_serializer.rb +++ b/instrumentation/mongo/lib/opentelemetry/instrumentation/mongo/command_serializer.rb @@ -75,7 +75,7 @@ def build_pipeline pipeline = command['pipeline'] return unless pipeline - payload['pipeline'] = pipeline.map(&method(:mask)) + payload['pipeline'] = pipeline.map { |x| mask(x) } end def add_val(payload, command, key) diff --git a/instrumentation/rspec/lib/opentelemetry/instrumentation/rspec/formatter.rb b/instrumentation/rspec/lib/opentelemetry/instrumentation/rspec/formatter.rb index 538625c23b..11a37b8f82 100644 --- a/instrumentation/rspec/lib/opentelemetry/instrumentation/rspec/formatter.rb +++ b/instrumentation/rspec/lib/opentelemetry/instrumentation/rspec/formatter.rb @@ -121,7 +121,7 @@ def strip_console_codes(string) end def multiple_failure_message(exception) - exception.failures.map(&:message).map(&method(:strip_console_codes)).join("\n\n") + exception.failures.map(&:message).map { |x| strip_console_codes(x) }.join("\n\n") end end end