A RuboCop plugin for the Callback Systems Ruby style in Rails applications and Ruby gems. It includes the
Callbacksystems/ cops and a shared configuration for RuboCop, rubocop-rails, rubocop-performance and rubocop-minitest.
You'll need Ruby 4.0 or newer and RuboCop 1.89 or newer. Add the gem to your Gemfile and run bundle install:
# Gemfile
gem "rubocop-callbacksystems", require: falseAdd the shared configuration to your .rubocop.yml:
inherit_gem:
rubocop-callbacksystems: rubocop.ymlThis loads the plugin, enables every Callbacksystems/ cop and applies the shared configuration. Run RuboCop with:
bundle exec rubocopTo use the cops with your own RuboCop configuration, load just the plugin:
plugins:
- rubocop-callbacksystemsMost cops apply to app/, lib/ or test/. See the cop reference for the rules and
config/default.yml for their options and paths.
The cops recommend Active Support methods such as many?, excluding, squish, ordinal array readers,
stringify_keys and symbolize_keys. Rails loads these when it boots. In a plain Ruby application or gem, require
active_support/all or the corresponding active_support/core_ext files at runtime. Loading the plugin for linting
does not make these methods available in your application.
Override inherited settings in your .rubocop.yml:
inherit_gem:
rubocop-callbacksystems: rubocop.yml
Callbacksystems/NoAbbreviations:
Enabled: false
Callbacksystems/TooManyLocalVariables:
MaxAssignments: 4bundle install
bin/test # run the test suite
bin/coverage # run the suite measuring lines, branches and methods
bin/rubocop # lint the gem with its own cops
bin/docs # regenerate the cop referenceThe test suite checks that docs/cops.md matches the cops. Run bin/docs after changing a cop's documentation.
Released under the MIT License.