0.0
No release in over 3 years
A collection of custom RuboCop cops for personal use, including i18n best practices.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 1.72.0
 Project Readme

RuboCop Asjer

Custom RuboCop cops: enforce i18n best practices and code quality standards.

Installation

Add to your application's Gemfile:

gem 'rubocop-asjer', require: false

Then run:

bundle install

Usage

Add to your .rubocop.yml:

plugins:
  - rubocop-asjer

Note: The plugins directive requires RuboCop 1.72+. For older versions, use require: rubocop-asjer instead.

Available Cops

Asjer/NoDefaultTranslation

Checks for translation calls that use the default: option. Using default: bypasses the locale system and can lead to inconsistencies.

# bad
t('some.key', default: 'fallback text')
I18n.t('some.key', default: 'fallback')
I18n.translate('some.key', default: t('other.key'))

# good
t('some.key')
I18n.t('some.key')

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bundle exec rspec to run the tests.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/asjer/rubocop-asjer.

License

The gem is available as open source under the terms of the MIT License.