Skip to content

Commit 4c2f6ad

Browse files
chore: fix new rubocop lints (#398)
* chore: fix new rubocop lints * chore: add back comments
1 parent 4fb3ddf commit 4c2f6ad

12 files changed

Lines changed: 34 additions & 67 deletions

File tree

temporalio/lib/temporalio/internal/bridge/client.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ class Client
1616
:tls, # Optional
1717
:rpc_retry,
1818
:keep_alive, # Optional
19-
:http_connect_proxy, # Optional
20-
keyword_init: true
19+
:http_connect_proxy # Optional
2120
)
2221

2322
TLSOptions = Struct.new(
2423
:client_cert, # Optional
2524
:client_private_key, # Optional
2625
:server_root_ca_cert, # Optional
27-
:domain, # Optional
28-
keyword_init: true
26+
:domain # Optional
2927
)
3028

3129
RPCRetryOptions = Struct.new(
@@ -34,21 +32,18 @@ class Client
3432
:multiplier,
3533
:max_interval,
3634
:max_elapsed_time, # Can use 0 for none
37-
:max_retries,
38-
keyword_init: true
35+
:max_retries
3936
)
4037

4138
KeepAliveOptions = Struct.new(
4239
:interval,
43-
:timeout,
44-
keyword_init: true
40+
:timeout
4541
)
4642

4743
HTTPConnectProxyOptions = Struct.new(
4844
:target_host,
4945
:basic_auth_user, # Optional
50-
:basic_auth_pass, # Optional,
51-
keyword_init: true
46+
:basic_auth_pass # Optional
5247
)
5348

5449
def self.new(runtime, options)

temporalio/lib/temporalio/internal/bridge/runtime.rb

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@ module Bridge
66
class Runtime
77
Options = Struct.new(
88
:telemetry,
9-
:worker_heartbeat_interval,
10-
keyword_init: true
9+
:worker_heartbeat_interval
1110
)
1211

1312
TelemetryOptions = Struct.new(
1413
:logging, # Optional
15-
:metrics, # Optional
16-
keyword_init: true
14+
:metrics # Optional
1715
)
1816

1917
LoggingOptions = Struct.new(
2018
:log_filter,
21-
:forward_to, # Optional
22-
keyword_init: true
19+
:forward_to # Optional
2320
)
2421

2522
MetricsOptions = Struct.new(
@@ -28,8 +25,7 @@ class Runtime
2825
:buffered_with_size, # Optional
2926
:attach_service_name,
3027
:global_tags, # Optional
31-
:metric_prefix, # Optional
32-
keyword_init: true
28+
:metric_prefix # Optional
3329
)
3430

3531
OpenTelemetryMetricsOptions = Struct.new(
@@ -39,17 +35,15 @@ class Runtime
3935
:metric_temporality_delta,
4036
:durations_as_seconds,
4137
:http,
42-
:histogram_bucket_overrides, # Optional
43-
keyword_init: true
38+
:histogram_bucket_overrides # Optional
4439
)
4540

4641
PrometheusMetricsOptions = Struct.new(
4742
:bind_address,
4843
:counters_total_suffix,
4944
:unit_suffix,
5045
:durations_as_seconds,
51-
:histogram_bucket_overrides, # Optional
52-
keyword_init: true
46+
:histogram_bucket_overrides # Optional
5347
)
5448
end
5549
end

temporalio/lib/temporalio/internal/bridge/testing.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class EphemeralServer
2222
:log_format,
2323
:log_level,
2424
:extra_args,
25-
:download_ttl, # Optional
26-
keyword_init: true
25+
:download_ttl # Optional
2726
)
2827

2928
StartTestServerOptions = Struct.new(
@@ -34,8 +33,7 @@ class EphemeralServer
3433
:download_dest_dir, # Optional
3534
:port, # Optional
3635
:extra_args,
37-
:download_ttl, # Optional
38-
keyword_init: true
36+
:download_ttl # Optional
3937
)
4038

4139
def self.start_dev_server(runtime, options)

temporalio/lib/temporalio/internal/bridge/worker.rb

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,56 +28,48 @@ class Worker
2828
:nondeterminism_as_workflow_fail,
2929
:nondeterminism_as_workflow_fail_for_types,
3030
:deployment_options,
31-
:plugins,
32-
keyword_init: true
31+
:plugins
3332
)
3433

3534
TunerOptions = Struct.new(
3635
:workflow_slot_supplier,
3736
:activity_slot_supplier,
38-
:local_activity_slot_supplier,
39-
keyword_init: true
37+
:local_activity_slot_supplier
4038
)
4139

4240
TunerSlotSupplierOptions = Struct.new(
4341
:fixed_size,
4442
:resource_based,
45-
:custom,
46-
keyword_init: true
43+
:custom
4744
)
4845

4946
TunerResourceBasedSlotSupplierOptions = Struct.new(
5047
:target_mem_usage,
5148
:target_cpu_usage,
5249
:min_slots,
5350
:max_slots,
54-
:ramp_throttle,
55-
keyword_init: true
51+
:ramp_throttle
5652
)
5753

5854
WorkerDeploymentVersion = Struct.new(
5955
:deployment_name,
60-
:build_id,
61-
keyword_init: true
56+
:build_id
6257
)
6358

6459
DeploymentOptions = Struct.new(
6560
:version,
6661
:use_worker_versioning,
67-
:default_versioning_behavior,
68-
keyword_init: true
62+
:default_versioning_behavior
6963
)
7064

7165
PollerBehaviorSimpleMaximum = Struct.new(
72-
:simple_maximum,
73-
keyword_init: true
66+
:simple_maximum
7467
)
7568

7669
PollerBehaviorAutoscaling = Struct.new(
7770
:minimum,
7871
:maximum,
79-
:initial,
80-
keyword_init: true
72+
:initial
8173
)
8274

8375
def self.finalize_shutdown_all(workers)

temporalio/lib/temporalio/internal/proto_utils.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def self.memo_to_proto_hash(hash, converter)
5353
def self.memo_from_proto(memo, converter)
5454
return nil if memo.nil? || memo.fields.size.zero? # rubocop:disable Style/ZeroLengthPredicate -- Google Maps don't have empty
5555

56-
memo.fields.each_with_object({}) { |(key, val), h| h[key] = converter.from_payload(val) } # rubocop:disable Style/HashTransformValues
56+
memo.fields.each_with_object({}) { |(key, val), h| h[key] = converter.from_payload(val) }
5757
end
5858

5959
def self.headers_to_proto(headers, converter)
@@ -75,7 +75,7 @@ def self.headers_from_proto(headers, converter)
7575
def self.headers_from_proto_map(headers, converter)
7676
return nil if headers.nil? || headers.size.zero? # rubocop:disable Style/ZeroLengthPredicate -- Google Maps don't have empty
7777

78-
headers.each_with_object({}) do |(key, val), h| # rubocop:disable Style/HashTransformValues
78+
headers.each_with_object({}) do |(key, val), h|
7979
# @type var h: Hash[String, Object?]
8080
h[key] = converter.from_payload(val)
8181
end

temporalio/lib/temporalio/search_attributes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def validate_value(value)
5858
when IndexedValueType::TIME
5959
raise TypeError, 'Value of TIME key must be a Time' unless value.is_a?(Time)
6060
when IndexedValueType::KEYWORD_LIST
61-
unless value.is_a?(Array) && value.all? { |v| v.is_a?(String) }
61+
unless value.is_a?(Array) && value.all?(String)
6262
raise TypeError, 'Value of KEYWORD_LIST key must be an Array of String'
6363
end
6464
else

temporalio/lib/temporalio/worker.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def self._run_all_root(
163163
)
164164
# Confirm there is at least one and they are all workers
165165
raise ArgumentError, 'At least one worker required' if workers.empty?
166-
raise ArgumentError, 'Not all parameters are workers' unless workers.all? { |w| w.is_a?(Worker) }
166+
raise ArgumentError, 'Not all parameters are workers' unless workers.all?(Worker)
167167

168168
Internal::Bridge.assert_fiber_compatibility!
169169

@@ -558,12 +558,8 @@ def _initialize_from_options
558558
)
559559

560560
# Collect interceptors from client and params
561-
@activity_interceptors = (@options.client.options.interceptors + @options.interceptors).select do |i|
562-
i.is_a?(Interceptor::Activity)
563-
end
564-
@workflow_interceptors = (@options.client.options.interceptors + @options.interceptors).select do |i|
565-
i.is_a?(Interceptor::Workflow)
566-
end
561+
@activity_interceptors = (@options.client.options.interceptors + @options.interceptors).grep(Interceptor::Activity)
562+
@workflow_interceptors = (@options.client.options.interceptors + @options.interceptors).grep(Interceptor::Workflow)
567563

568564
# Cancellation for the whole worker
569565
@worker_shutdown_cancellation = Cancellation.new

temporalio/lib/temporalio/worker/workflow_replayer.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,7 @@ def initialize(
258258
logger: options.logger,
259259
data_converter: options.data_converter,
260260
metric_meter: options.runtime.metric_meter,
261-
workflow_interceptors: options.interceptors.select do |i|
262-
i.is_a?(Interceptor::Workflow)
263-
end,
261+
workflow_interceptors: options.interceptors.grep(Interceptor::Workflow),
264262
disable_eager_activity_execution: false,
265263
illegal_workflow_calls: options.illegal_workflow_calls,
266264
workflow_failure_exception_types: options.workflow_failure_exception_types,

temporalio/lib/temporalio/workflow/info.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ module Workflow
2323
:task_queue,
2424
:task_timeout,
2525
:workflow_id,
26-
:workflow_type,
27-
keyword_init: true
26+
:workflow_type
2827
)
2928

3029
# Information about the running workflow. This is immutable for the life of the workflow run.
@@ -91,8 +90,7 @@ class Info
9190
ParentInfo = Struct.new(
9291
:namespace,
9392
:run_id,
94-
:workflow_id,
95-
keyword_init: true
93+
:workflow_id
9694
)
9795

9896
# Information about a root of a workflow.
@@ -106,8 +104,7 @@ class Info
106104
# this class or it may break in incompatible ways.
107105
RootInfo = Struct.new(
108106
:run_id,
109-
:workflow_id,
110-
keyword_init: true
107+
:workflow_id
111108
)
112109
end
113110
end

temporalio/lib/temporalio/workflow/update_info.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ module Workflow
1313
# class or it may break in incompatible ways.
1414
UpdateInfo = Struct.new(
1515
:id,
16-
:name,
17-
keyword_init: true
16+
:name
1817
)
1918
end
2019
end

0 commit comments

Comments
 (0)