Skip to content

Commit 81e50d2

Browse files
committed
Fix: update google-style to 1.31, fix linting issues
1 parent 5a42d1e commit 81e50d2

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ source "https://rubygems.org"
1717
gemspec
1818

1919
gem "base64"
20-
gem "google-style", "~> 1.30.1"
20+
gem "google-style", "~> 1.31.0"
2121
gem "minitest", "~> 5.16"
2222
gem "minitest-focus", "~> 1.2"
2323
gem "minitest-rg", "~> 5.2"

functions_framework.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ version = ::FunctionsFramework::VERSION
4444
spec.bindir = "bin"
4545
spec.executables = ["functions-framework", "functions-framework-ruby"]
4646

47-
spec.required_ruby_version = ">= 3.0.0"
47+
spec.required_ruby_version = ">= 3.1.0"
4848
spec.add_dependency "cloud_events", ">= 0.7.0", "< 2.a"
4949
spec.add_dependency "puma", ">= 4.3.0", "< 7.a"
5050
spec.add_dependency "rack", ">= 2.1", "< 4.a"

lib/functions_framework.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ class << self
137137
# @param block [Proc] The function code as a proc.
138138
# @return [self]
139139
#
140-
def http name = DEFAULT_TARGET, &block
141-
global_registry.add_http name, &block
140+
def http(name = DEFAULT_TARGET, &)
141+
global_registry.add_http(name, &)
142142
self
143143
end
144144

@@ -167,8 +167,8 @@ def http name = DEFAULT_TARGET, &block
167167
# @param block [Proc] The function code as a proc @return [self]
168168
# @return [self]
169169
#
170-
def typed name = DEFAULT_TARGET, request_class: nil, &block
171-
global_registry.add_typed name, request_class: request_class, &block
170+
def typed(name = DEFAULT_TARGET, request_class: nil, &)
171+
global_registry.add_typed(name, request_class: request_class, &)
172172
self
173173
end
174174

@@ -190,8 +190,8 @@ def typed name = DEFAULT_TARGET, request_class: nil, &block
190190
# @param block [Proc] The function code as a proc.
191191
# @return [self]
192192
#
193-
def cloud_event name = DEFAULT_TARGET, &block
194-
global_registry.add_cloud_event name, &block
193+
def cloud_event(name = DEFAULT_TARGET, &)
194+
global_registry.add_cloud_event(name, &)
195195
self
196196
end
197197

@@ -211,8 +211,8 @@ def cloud_event name = DEFAULT_TARGET, &block
211211
# @param block [Proc] The startup task
212212
# @return [self]
213213
#
214-
def on_startup &block
215-
global_registry.add_startup_task(&block)
214+
def on_startup(&)
215+
global_registry.add_startup_task(&)
216216
self
217217
end
218218

@@ -227,7 +227,7 @@ def on_startup &block
227227
# manipulated to configure the server.
228228
# @return [FunctionsFramework::Server]
229229
#
230-
def start target, &block
230+
def start(target, &)
231231
require "functions_framework/server"
232232
if target.is_a? ::FunctionsFramework::Function
233233
function = target
@@ -236,7 +236,7 @@ def start target, &block
236236
raise ::ArgumentError, "Undefined function: #{target.inspect}" if function.nil?
237237
end
238238
globals = function.populate_globals
239-
server = Server.new function, globals, &block
239+
server = Server.new(function, globals, &)
240240
global_registry.startup_tasks.each do |task|
241241
task.call function, globals: globals, logger: server.config.logger
242242
end
@@ -255,8 +255,8 @@ def start target, &block
255255
# manipulated to configure the server.
256256
# @return [self]
257257
#
258-
def run target, &block
259-
server = start target, &block
258+
def run(target, &)
259+
server = start(target, &)
260260
server.wait_until_stopped
261261
self
262262
end

lib/functions_framework/legacy_event_converter.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def convert_data context, data
185185
%r{^providers/google\.firebase\.analytics/} => "firebase.googleapis.com",
186186
%r{^providers/google\.firebase\.database/} => "firebasedatabase.googleapis.com"
187187
}.freeze
188+
private_constant :LEGACY_TYPE_TO_SERVICE
188189

189190
LEGACY_TYPE_TO_CE_TYPE = {
190191
"google.pubsub.topic.publish" => "google.cloud.pubsub.topic.v1.messagePublished",
@@ -206,18 +207,21 @@ def convert_data context, data
206207
"providers/google.firebase.database/eventTypes/ref.delete" => "google.firebase.database.ref.v1.deleted",
207208
"providers/cloud.storage/eventTypes/object.change" => "google.cloud.storage.object.v1.finalized"
208209
}.freeze
210+
private_constant :LEGACY_TYPE_TO_CE_TYPE
209211

210212
CE_SERVICE_TO_RESOURCE_RE = {
211213
"firebase.googleapis.com" => %r{^(projects/[^/]+)/(events/[^/]+)$},
212214
"firebasedatabase.googleapis.com" => %r{^projects/_/(instances/[^/]+)/(refs/.+)$},
213215
"firestore.googleapis.com" => %r{^(projects/[^/]+/databases/\(default\))/(documents/.+)$},
214216
"storage.googleapis.com" => %r{^(projects/[^/]+/buckets/[^/]+)/([^#]+)(?:#.*)?$}
215217
}.freeze
218+
private_constant :CE_SERVICE_TO_RESOURCE_RE
216219

217220
# Map Firebase Auth legacy event metadata field names to their equivalent CloudEvent field names.
218221
FIREBASE_AUTH_METADATA_LEGACY_TO_CE = {
219222
"createdAt" => "createTime",
220223
"lastSignedInAt" => "lastSignInTime"
221224
}.freeze
225+
private_constant :FIREBASE_AUTH_METADATA_LEGACY_TO_CE
222226
end
223227
end

lib/functions_framework/testing.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ module Testing
7070
#
7171
# @param path [String] File path to load
7272
#
73-
def load_temporary path, &block
73+
def load_temporary(path, &)
7474
path = ::File.expand_path path
75-
Testing.load_for_testing path, &block
75+
Testing.load_for_testing(path, &)
7676
end
7777

7878
##

0 commit comments

Comments
 (0)