Add and apply Naming/BlockForwarding rubocop rule

This syntax has been added in Ruby 3.1.

Not using a variable name might not be very descriptive, but it's just
as descriptive as using "block" as a variable name. Using just `&` we
get the same amount of information than using `&block`: that we're
passing a block.

We're still using `&action` in `around_action` methods because here we
aren't using a generic name for the variable, so (at least for now) we
aren't running this cop on controllers using `around_action`.
This commit is contained in:
Javi Martín
2023-07-20 03:42:07 +02:00
parent fd9169e0d6
commit f87d4b589d
11 changed files with 32 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
module Types
class BaseObject < GraphQL::Schema::Object
def self.field(*args, **kwargs, &block)
super(*args, **kwargs, &block)
def self.field(*args, **kwargs, &)
super(*args, **kwargs, &)
# The old api contained non-camelized fields
# We want to support these for now, but throw a deprecation warning
@@ -14,7 +14,7 @@ module Types
if field_name.to_s.include?("_")
reason = "Snake case fields are deprecated. Please use #{field_name.to_s.camelize(:lower)}."
kwargs = kwargs.merge({ camelize: false, deprecation_reason: reason })
super(*args, **kwargs, &block)
super(*args, **kwargs, &)
end
# Make sure associations only return public records