Skip to content

Commit

Permalink
Merge pull request #850 from vlad-pisanov/vp_fix_i18n_lazy_lookup
Browse files Browse the repository at this point in the history
Fix default configuration for Rails/I18nLazyLookup
  • Loading branch information
koic authored Nov 8, 2022
2 parents 7855505 + 5b54cfe commit 0189504
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/fix_i18n_lazy_lookup_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#850](https://github.com/rubocop/rubocop-rails/pull/850): Fix default configuration for `Rails/I18nLazyLookup`. ([@vlad-pisanov][])
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ Rails/I18nLazyLookup:
Enabled: pending
VersionAdded: '2.14'
Include:
- 'controllers/**/*'
- 'app/controllers/**/*.rb'

Rails/I18nLocaleAssignment:
Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'
Expand Down
2 changes: 2 additions & 0 deletions lib/rubocop/cop/rails/i18n_lazy_lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class I18nLazyLookup < Base

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

RESTRICT_ON_SEND = %i[translate t].freeze

def_node_matcher :translate_call?, <<~PATTERN
(send nil? {:translate :t} ${sym_type? str_type?} ...)
PATTERN
Expand Down

0 comments on commit 0189504

Please sign in to comment.