Verified Commit 53d20bea authored by Peter Leitzen's avatar Peter Leitzen
Browse files

Fix kwargs deprecation warnings for Ruby 2.7.2

This commit fixes deprecation warnings such as

  warning: Using the last argument as keyword parameters is deprecated;
  maybe ** should be added to the call
parent 57d75af8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ module Labkit
          warn message
        end

        Jaeger::Client.build(kwargs)
        Jaeger::Client.build(**kwargs)
      end

      def self.get_sampler(sampler_type, sampler_param)
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ module Labkit
      # Add exception logging to a span
      def self.log_exception_on_span(span, exception)
        span.set_tag("error", true)
        span.log_kv(kv_tags_for_exception(exception))
        span.log_kv(**kv_tags_for_exception(exception))
      end

      # Generate key-value tags for an exception
+2 −2
Original line number Diff line number Diff line
@@ -10,11 +10,11 @@ describe Labkit::Correlation::GRPC::ClientInterceptor do
      let(:custom_error) { Class.new(StandardError) }

      it "yields" do
        expect { |b| method.call(kwargs, &b) }.to yield_control
        expect { |b| method.call(**kwargs, &b) }.to yield_control
      end

      it "propagates exceptions" do
        expect { method.call(kwargs) { raise custom_error } }.to raise_error(custom_error)
        expect { method.call(**kwargs) { raise custom_error } }.to raise_error(custom_error)
      end
    end

+2 −2
Original line number Diff line number Diff line
@@ -7,11 +7,11 @@ describe Labkit::Tracing::GRPC::ClientInterceptor do
    let(:custom_error) { Class.new(StandardError) }

    it "yields" do
      expect { |b| method.call(kwargs, &b) }.to yield_control
      expect { |b| method.call(**kwargs, &b) }.to yield_control
    end

    it "propagates exceptions" do
      expect { method.call(kwargs) { raise custom_error } }.to raise_error(custom_error)
      expect { method.call(**kwargs) { raise custom_error } }.to raise_error(custom_error)
    end
  end

+2 −2
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ describe Labkit::Tracing do
                                                 .with(params)
                                                 .and_yield

      expect { |b| described_class.with_tracing(params, &b) }.to yield_control
      expect { |b| described_class.with_tracing(**params, &b) }.to yield_control
    end

    let(:fake_span) { double("OpenTracing span") }
@@ -88,7 +88,7 @@ describe Labkit::Tracing do

      params = { operation_name: "example: name", tags: { foo: :bar } }

      described_class.with_tracing(params) { }
      described_class.with_tracing(**params) { }
    end
  end