A standardized RuboCop configuration gem that automatically detects available RuboCop plugins and generates appropriate configurations with CLI tools for easy setup and maintenance.
- Automatic Plugin Detection: Automatically detects installed RuboCop plugins and includes their configurations
- CLI Tools: Easy-to-use commands for initialization and maintenance
- Comprehensive Coverage: Supports all major RuboCop plugins out of the box
- Documentation Links: Generated configurations include links to official documentation
- Smart Detection: Uses gem metadata to automatically detect installed RuboCop plugins
- Incremental Setup: Generates
.rubocop_todo.yml
for gradual adoption
Add it to your Gemfile:
group :development do
gem "docquet", require: false
end
Then run:
bundle install
Or install it as a standalone gem:
gem install docquet
Run the installation command in your project root:
docquet install-config
This command will:
- Generate
.rubocop.yml
with configurations for detected plugins - Create an initial
.rubocop_todo.yml
with existing violations - Display next steps for gradual adoption
To overwrite existing files:
docquet install-config --force
When you've fixed some violations and want to regenerate the TODO file:
docquet regenerate-todo
This command will:
- Regenerate
.rubocop_todo.yml
with current violations - Show whether the TODO file changed
- Provide feedback on progress
The gem automatically detects and configures the following plugins when installed:
- Bundler: Bundler-related rules
- Gemspec: Gemspec file rules
- Layout: Code formatting and layout rules
- Lint: Rules for catching potential bugs
- Metrics: Code complexity and size metrics
- Naming: Naming convention rules
- Security: Security-related rules
- Style: General code style rules
- rubocop-capybara: Capybara testing framework rules
- rubocop-i18n: Internationalization rules (GetText, Rails I18n)
- rubocop-migration: Database migration rules (for Rails applications)
- rubocop-performance: Performance optimization rules
- rubocop-rake: Rake task rules
- rubocop-rspec: RSpec testing framework rules (including Capybara integration)
- rubocop-sequel: Sequel ORM rules
- rubocop-thread_safety: Thread safety rules
The generated .rubocop.yml
file includes:
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
EnabledByDefault: true
Exclude:
- bin/**/*
- vendor/**/*
ExtraDetails: true
NewCops: enable
TargetRubyVersion: 3.2 # Detected from .ruby-version or current Ruby
UseCache: true
plugins:
- rubocop-performance # Auto-detected plugins
- rubocop-rspec
# ... other detected plugins
inherit_gem:
docquet:
- config/cops/style.yml # Core style rules
- config/cops/layout.yml # Core layout rules
- config/cops/performance.yml # Performance rules (if plugin detected)
- config/cops/rspec.yml # RSpec rules (if plugin detected)
# ... other detected plugins
inherit_from: .rubocop_todo.yml
Each configuration file includes:
- Department-specific rules
- Links to official RuboCop documentation
- Carefully curated cop configurations
- Optimized settings for practical use
The configuration uses EnabledByDefault: true
for strict code quality enforcement with TODO file for gradual adoption.
This configuration aims to:
- Enforce Consistency: Standardize code style across projects
- Promote Best Practices: Enable rules that catch common issues
- Provide Documentation: Include links to understand each rule
- Enable Gradual Adoption: Use TODO files for incremental improvements
- Stay Current: Automatically adapt to installed plugin versions
bundle install
bundle exec rspec
bundle exec rubocop
# Test installation command
./exe/docquet install-config
# Test TODO regeneration
./exe/docquet regenerate-todo
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run the test suite:
bundle exec rspec
- Run RuboCop:
bundle exec rubocop
- Submit a pull request
This gem is available as open source under the terms of the MIT License.