Skip to content

Commit d5d689b

Browse files
authored
Enable standard in test suite (#4925)
1 parent 4ab26d0 commit d5d689b

File tree

274 files changed

+2095
-2073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+2095
-2073
lines changed

.rubocop.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ AllCops:
2222
- "spec/**/**/interesting_backtrace_helper.rb" # This file needs quite a few bizarre code patterns by design
2323
- "vendor/bundle/**/*"
2424
- "spec/datadog/tracing/contrib/grpc/support/gen/**/*.rb" # Skip protoc autogenerated code
25-
- spec/datadog/di/**/*
26-
- spec/datadog/core/**/*
27-
- spec/datadog/appsec/**/*
28-
- spec/rubocop/**/*
25+
- spec/**/*
2926
NewCops: disable # Don't allow new cops to be enabled implicitly.
3027
SuggestExtensions: false # Stop pushing suggestions constantly.
3128

.standard_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,3 @@ ignore:
2727
- integration/**/**
2828
- lib-injection/**/**
2929
- lib/datadog/**/vendor/**/*
30-
- spec/*
31-
- spec/datadog/*
32-
- spec/datadog/core/**/**
33-
- spec/datadog/di/integration/*_test_class*.rb
34-
- spec/datadog/opentelemetry/**/**
35-
- spec/datadog/tracing/**/**
36-
- spec/support/**/**

spec/datadog/core/configuration/agent_settings_resolver_spec.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272
describe 'http adapter hostname' do
7373
context 'when a custom hostname is specified via the DD_AGENT_HOST environment variable' do
74-
let(:environment) { { 'DD_AGENT_HOST' => 'custom-hostname' } }
74+
let(:environment) { {'DD_AGENT_HOST' => 'custom-hostname'} }
7575

7676
it 'contacts the agent using the http adapter, using the custom hostname' do
7777
expect(resolver).to have_attributes(**settings, hostname: 'custom-hostname')
@@ -89,7 +89,7 @@
8989
end
9090

9191
context 'when a custom hostname is specified via the DD_TRACE_AGENT_URL environment variable' do
92-
let(:environment) { { 'DD_TRACE_AGENT_URL' => "http://custom-hostname:#{port}" } }
92+
let(:environment) { {'DD_TRACE_AGENT_URL' => "http://custom-hostname:#{port}"} }
9393

9494
it 'contacts the agent using the http adapter, using the custom hostname' do
9595
expect(resolver).to have_attributes(**settings, hostname: 'custom-hostname')
@@ -312,14 +312,14 @@
312312
end
313313

314314
context 'when a custom port is specified via the DD_TRACE_AGENT_PORT environment variable' do
315-
let(:environment) { { 'DD_TRACE_AGENT_PORT' => '1234' } }
315+
let(:environment) { {'DD_TRACE_AGENT_PORT' => '1234'} }
316316

317317
it 'contacts the agent using the http adapter, using the custom port' do
318318
expect(resolver).to have_attributes(**settings, port: 1234)
319319
end
320320

321321
context 'when the custom port is invalid' do
322-
let(:environment) { { 'DD_TRACE_AGENT_PORT' => 'this-is-an-invalid-port' } }
322+
let(:environment) { {'DD_TRACE_AGENT_PORT' => 'this-is-an-invalid-port'} }
323323

324324
before do
325325
allow(logger).to receive(:warn)
@@ -354,7 +354,7 @@
354354
end
355355

356356
context 'when a custom port is specified via the DD_TRACE_AGENT_URL environment variable' do
357-
let(:environment) { { 'DD_TRACE_AGENT_URL' => "http://#{hostname}:1234" } }
357+
let(:environment) { {'DD_TRACE_AGENT_URL' => "http://#{hostname}:1234"} }
358358

359359
it 'contacts the agent using the http adapter, using the custom port' do
360360
expect(resolver).to have_attributes(**settings, port: 1234)
@@ -476,14 +476,14 @@
476476
end
477477

478478
context 'when a custom timeout is specified via the DD_TRACE_AGENT_TIMEOUT_SECONDS environment variable' do
479-
let(:environment) { { 'DD_TRACE_AGENT_TIMEOUT_SECONDS' => '798' } }
479+
let(:environment) { {'DD_TRACE_AGENT_TIMEOUT_SECONDS' => '798'} }
480480

481481
it 'contacts the agent using the http adapter, using the custom timeout' do
482482
expect(resolver).to have_attributes(**settings, timeout_seconds: 798)
483483
end
484484

485485
context 'when the custom timeout is invalid' do
486-
let(:environment) { { 'DD_TRACE_AGENT_TIMEOUT_SECONDS' => 'this-is-an-invalid-timeout' } }
486+
let(:environment) { {'DD_TRACE_AGENT_TIMEOUT_SECONDS' => 'this-is-an-invalid-timeout'} }
487487

488488
before do
489489
allow(logger).to receive(:warn)
@@ -588,7 +588,7 @@
588588
end
589589

590590
context 'when DD_TRACE_AGENT_URL is set' do
591-
let(:environment) { { 'DD_TRACE_AGENT_URL' => "#{trace_agent_url_protocol}://custom-hostname:1234" } }
591+
let(:environment) { {'DD_TRACE_AGENT_URL' => "#{trace_agent_url_protocol}://custom-hostname:1234"} }
592592

593593
context 'when set to https' do
594594
let(:trace_agent_url_protocol) { 'https' }
@@ -656,7 +656,7 @@
656656
end
657657

658658
context 'when a custom url is specified via environment variable' do
659-
let(:environment) { { 'DD_TRACE_AGENT_URL' => 'http://custom-hostname:1234' } }
659+
let(:environment) { {'DD_TRACE_AGENT_URL' => 'http://custom-hostname:1234'} }
660660

661661
it 'contacts the agent using the http adapter, using the custom hostname and port' do
662662
expect(resolver).to have_attributes(
@@ -668,15 +668,15 @@
668668
end
669669

670670
context 'when the uri scheme is https' do
671-
let(:environment) { { 'DD_TRACE_AGENT_URL' => 'https://custom-hostname:1234' } }
671+
let(:environment) { {'DD_TRACE_AGENT_URL' => 'https://custom-hostname:1234'} }
672672

673673
it 'contacts the agent using the http adapter, using ssl: true' do
674674
expect(resolver).to have_attributes(ssl: true)
675675
end
676676
end
677677

678678
context 'when the uri scheme is unix' do
679-
let(:environment) { { 'DD_TRACE_AGENT_URL' => 'unix:///path/to/apm.socket' } }
679+
let(:environment) { {'DD_TRACE_AGENT_URL' => 'unix:///path/to/apm.socket'} }
680680
let(:timeout_seconds) { 30 }
681681

682682
it 'contacts the agent via a unix domain socket' do
@@ -691,7 +691,7 @@
691691
end
692692

693693
context 'when the uri scheme is not http OR https' do
694-
let(:environment) { { 'DD_TRACE_AGENT_URL' => 'steam://custom-hostname:1234' } }
694+
let(:environment) { {'DD_TRACE_AGENT_URL' => 'steam://custom-hostname:1234'} }
695695

696696
before do
697697
allow(logger).to receive(:warn)
@@ -726,7 +726,7 @@
726726
end
727727

728728
context 'when a custom path is specified via the DD_TRACE_AGENT_URL environment variable' do
729-
let(:environment) { { 'DD_TRACE_AGENT_URL' => 'unix:///var/uri.socket' } }
729+
let(:environment) { {'DD_TRACE_AGENT_URL' => 'unix:///var/uri.socket'} }
730730

731731
it 'contacts the agent using the unix adapter, using the custom path' do
732732
expect(resolver).to have_attributes(**settings, uds_path: '/var/uri.socket')

spec/datadog/core/configuration/agent_settings_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'datadog/core/configuration/agent_settings'
22

33
RSpec.describe Datadog::Core::Configuration::AgentSettings do
4-
54
describe '#url' do
65
context 'when using an unknown adapter' do
76
it 'raises an exception' do
@@ -12,4 +11,3 @@
1211
end
1312
end
1413
end
15-

spec/datadog/core/configuration/base_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
describe '#initialize' do
5555
subject(:base_object) { base_class.new(options) }
5656

57-
let(:options) { { foo: :bar } }
57+
let(:options) { {foo: :bar} }
5858

5959
before { allow_any_instance_of(base_class).to receive(:configure) }
6060

@@ -68,7 +68,7 @@
6868
subject(:configure) { base_object.configure(options) }
6969

7070
context 'when given an option' do
71-
let(:options) { { foo: :bar } }
71+
let(:options) { {foo: :bar} }
7272

7373
context 'that is not defined' do
7474
it { expect { configure }.to_not raise_error }

spec/datadog/core/configuration/components_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
end
4040
end
4141

42-
let(:environment_logger_extra) { { hello: 123, world: '456' } }
42+
let(:environment_logger_extra) { {hello: 123, world: '456'} }
4343

4444
include_context 'non-development execution environment'
4545

@@ -166,7 +166,7 @@
166166
context 'given settings' do
167167
shared_examples_for 'new health metrics' do
168168
let(:health_metrics) { instance_double(Datadog::Core::Diagnostics::Health::Metrics) }
169-
let(:default_options) { { enabled: settings.health_metrics.enabled } }
169+
let(:default_options) { {enabled: settings.health_metrics.enabled} }
170170
let(:options) { {} }
171171

172172
before do
@@ -192,7 +192,7 @@
192192
end
193193

194194
it_behaves_like 'new health metrics' do
195-
let(:options) { { enabled: enabled } }
195+
let(:options) { {enabled: enabled} }
196196
end
197197
end
198198

@@ -206,7 +206,7 @@
206206
end
207207

208208
it_behaves_like 'new health metrics' do
209-
let(:options) { { statsd: statsd } }
209+
let(:options) { {statsd: statsd} }
210210
end
211211
end
212212
end
@@ -303,9 +303,9 @@
303303
shared_examples_for 'new runtime metrics' do
304304
let(:runtime_metrics) { instance_double(Datadog::Core::Runtime::Metrics) }
305305
let(:default_options) do
306-
{ enabled: settings.runtime_metrics.enabled,
307-
services: [settings.service],
308-
experimental_runtime_id_enabled: settings.runtime_metrics.experimental_runtime_id_enabled, }
306+
{enabled: settings.runtime_metrics.enabled,
307+
services: [settings.service],
308+
experimental_runtime_id_enabled: settings.runtime_metrics.experimental_runtime_id_enabled,}
309309
end
310310
let(:options) { {} }
311311

@@ -332,7 +332,7 @@
332332
end
333333

334334
it_behaves_like 'new runtime metrics' do
335-
let(:options) { { enabled: enabled } }
335+
let(:options) { {enabled: enabled} }
336336
end
337337
end
338338

@@ -346,7 +346,7 @@
346346
end
347347

348348
it_behaves_like 'new runtime metrics' do
349-
let(:options) { { services: [service] } }
349+
let(:options) { {services: [service]} }
350350
end
351351
end
352352

@@ -360,7 +360,7 @@
360360
end
361361

362362
it_behaves_like 'new runtime metrics' do
363-
let(:options) { { statsd: statsd } }
363+
let(:options) { {statsd: statsd} }
364364
end
365365
end
366366

@@ -374,7 +374,7 @@
374374
end
375375

376376
it_behaves_like 'new runtime metrics' do
377-
let(:options) { { experimental_runtime_id_enabled: experimental_runtime_id_enabled } }
377+
let(:options) { {experimental_runtime_id_enabled: experimental_runtime_id_enabled} }
378378
end
379379
end
380380
end
@@ -422,12 +422,12 @@
422422
end
423423

424424
it_behaves_like 'new runtime metrics worker' do
425-
let(:options) { { enabled: enabled } }
425+
let(:options) { {enabled: enabled} }
426426
end
427427
end
428428

429429
context 'with :opts' do
430-
let(:opts) { { custom_option: :custom_value } }
430+
let(:opts) { {custom_option: :custom_value} }
431431

432432
before do
433433
allow(settings.runtime_metrics)
@@ -548,7 +548,7 @@
548548

549549
after { WebMock.disable! }
550550

551-
let(:info_response) { { endpoints: ['/v0.7/config'] }.to_json }
551+
let(:info_response) { {endpoints: ['/v0.7/config']}.to_json }
552552
end
553553

554554
context 'disabled' do

0 commit comments

Comments
 (0)