Multi-line i18n-tasks-use statement

234 views Asked by At

We have a repo that gets its I18n keys from incoming requests. So, I've been using i18n-tasks-useto explicitly declare all the keys we intend to use to satisfy our linter.

E.g.:

i18n-tasks-use # i18n-tasks-use t('notification.notification_name.alt_1')

However, some of the i18n-tasks-use statements are running over the rubocop line length limit. I've tried both multi-line i18n-tasks-use statements, but can't seem to get it to work.

Is there any way to create a multi-line i18n-tasks-use statement? Is there a better solution here?

1

There are 1 answers

0
Drenmi On

You can use a regular expression in the IgnoredPatterns configuration option to tell RuboCop to ignore lines matching it. Example:

# .rubocop.yml

Metrics/LineLength:
  IgnoredPatterns:
    - !ruby/regexp '^\w*# i18n-tasks-use.*$'

You might need to adjust the regular expression to your use case.