Skip to content

Commit 0189504

Browse files
authored
Merge pull request rubocop#850 from vlad-pisanov/vp_fix_i18n_lazy_lookup
Fix default configuration for Rails/I18nLazyLookup
2 parents 7855505 + 5b54cfe commit 0189504

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#850](https://github.com/rubocop/rubocop-rails/pull/850): Fix default configuration for `Rails/I18nLazyLookup`. ([@vlad-pisanov][])

config/default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ Rails/I18nLazyLookup:
540540
Enabled: pending
541541
VersionAdded: '2.14'
542542
Include:
543-
- 'controllers/**/*'
543+
- 'app/controllers/**/*.rb'
544544

545545
Rails/I18nLocaleAssignment:
546546
Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'

lib/rubocop/cop/rails/i18n_lazy_lookup.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class I18nLazyLookup < Base
3434

3535
MSG = 'Use "lazy" lookup for the text used in controllers.'
3636

37+
RESTRICT_ON_SEND = %i[translate t].freeze
38+
3739
def_node_matcher :translate_call?, <<~PATTERN
3840
(send nil? {:translate :t} ${sym_type? str_type?} ...)
3941
PATTERN

0 commit comments

Comments
 (0)