From ebdfab39a84714aa1e2ef82067b602ff128575f9 Mon Sep 17 00:00:00 2001 From: Watson Date: Thu, 15 Aug 2024 14:19:45 +0900 Subject: [PATCH] Suppress non-parenthesis warnings (#4590) This patch will suppress following warnings: ``` $ ruby -w -I"lib:test" test/plugin/test_out_http.rb test/plugin/test_out_http.rb:445: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator test/plugin/test_out_http.rb:446: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator test/plugin/test_out_http.rb:482: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator test/plugin/test_out_http.rb:483: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator ``` Seems we will see this warning If we omit the parentheses in the method and pass a regular expression as an argument. ``` irb(main):001> $VERBOSE=true => true irb(main):002> p /m/ (irb):2: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator /m/ => /m/ ``` Signed-off-by: Watson --- test/plugin/test_out_http.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/plugin/test_out_http.rb b/test/plugin/test_out_http.rb index 265568e876..5d3b89089c 100644 --- a/test/plugin/test_out_http.rb +++ b/test/plugin/test_out_http.rb @@ -442,8 +442,8 @@ def test_aws_sigv4_sts_role_arn assert_equal test_events, result.data assert_not_empty result.headers assert_not_nil result.headers['authorization'] - assert_match /AWS4-HMAC-SHA256 Credential=[a-zA-Z0-9]*\/\d+\/my-region-1\/someservice\/aws4_request/, result.headers['authorization'] - assert_match /SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token/, result.headers['authorization'] + assert_match(/AWS4-HMAC-SHA256 Credential=[a-zA-Z0-9]*\/\d+\/my-region-1\/someservice\/aws4_request/, result.headers['authorization']) + assert_match(/SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token/, result.headers['authorization']) assert_equal @@fake_aws_credentials.session_token, result.headers['x-amz-security-token'] assert_not_nil result.headers['x-amz-content-sha256'] assert_not_empty result.headers['x-amz-content-sha256'] @@ -479,8 +479,8 @@ def test_aws_sigv4_no_role assert_equal test_events, result.data assert_not_empty result.headers assert_not_nil result.headers['authorization'] - assert_match /AWS4-HMAC-SHA256 Credential=[a-zA-Z0-9]*\/\d+\/my-region-1\/someservice\/aws4_request/, result.headers['authorization'] - assert_match /SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token/, result.headers['authorization'] + assert_match(/AWS4-HMAC-SHA256 Credential=[a-zA-Z0-9]*\/\d+\/my-region-1\/someservice\/aws4_request/, result.headers['authorization']) + assert_match(/SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token/, result.headers['authorization']) assert_equal @@fake_aws_credentials.session_token, result.headers['x-amz-security-token'] assert_not_nil result.headers['x-amz-content-sha256'] assert_not_empty result.headers['x-amz-content-sha256']