RuboCop HK
A comprehensive RuboCop configuration for modern Ruby 3.3+ and Rails 7.1+ applications, featuring 45+ warning-only modern rules with team-focused gradual adoption.
Features
- Modern Ruby & Rails Support: Target Ruby 3.3+ and Rails 8.0+ with latest patterns
- Warning-Only Modern Rules: 45+ new rules as warnings to enable gradual adoption
- Team-Focused: Educational approach with clear explanations for each rule
- Zero Breaking Changes: All new features are opt-in warnings only
- Comprehensive Coverage: Style, Rails, RSpec, Performance, and Lint rules
- Production Ready: 100% test coverage with extensive CI/CD validation
Installation
Add this line to your application's Gemfile:
gem 'rubocop-hk', '~> 1.4.0', require: false
And then execute:
bundle install
Quick Start
- Create a
.rubocop.ymlfile in your project root:
inherit_gem:
rubocop-hk: config/default.yml
- Run RuboCop:
bundle exec rubocop
- Review warnings and gradually promote them to errors when your team is ready:
# View current warnings
bundle exec rubocop --format json | jq '.files[].offenses[] | select(.severity=="warning")'
# Use the promotion script (see documentation)
ruby scripts/promote-warnings.rb
Configuration Options
RuboCop HK provides several preconfigured options:
config/default.yml- Balanced configuration with modern warning-only rulesconfig/strict.yml- More stringent rules for mature codebasesconfig/rails.yml- Rails-specific optimizations
See CUSTOMIZATION.md for detailed configuration options.
Documentation
- Usage Guide - Comprehensive usage instructions and examples
- Gradual Adoption Guide - Team-focused 4-phase adoption strategy
- Modern Rules Reference - Educational explanations for all 45+ new rules
- Customization Guide - Advanced configuration and customization options
- Quick Start Guide - Getting started and basic setup
Requirements
- Ruby >= 3.3.0
- RuboCop >= 1.86.0
- Rails >= 7.1.0 (if using Rails cops)
New in v1.4.0
This release tracks the latest stable RuboCop toolchain:
- ⬆️ RuboCop 1.86 line - Widened the constraint to
>= 1.86.0, < 2.0so you always get the current 1.x release - 🔌 Updated plugins - rubocop-performance
~> 1.26, rubocop-rails~> 2.35, rubocop-rspec~> 3.9 - 🛠️ Config compatibility - Renamed the obsolete
Layout/LineLengthparameterIgnoreCopDirectivestoAllowCopDirectives - 🎯 Ruby 3.3 / 3.4 & Rails 7.1–8.1 - Verified across the supported matrix
- 📦 45+ warning-only modern rules - Gradual adoption without breaking builds
See CHANGELOG.md for complete release notes.
Contributing
Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
License
The gem is available as open source under the terms of the MIT License.