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

@@ -180,7 +180,7 @@ class Budget::Stats
stats_cache(*stats_methods)
def stats_cache(key, &block)
Rails.cache.fetch("budgets_stats/#{budget.id}/#{phases.join}/#{key}/#{version}", &block)
def stats_cache(key, &)
Rails.cache.fetch("budgets_stats/#{budget.id}/#{phases.join}/#{key}/#{version}", &)
end
end