0.0
The project is in a healthy, maintained state
RuboCop extension focusing on simplicity and eliminating redundancy.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

RuboCop Kanso (簡素)

RuboCop extension for writing clean, minimal Ruby code. Kanso (簡素) is a Japanese principle meaning simplicity through elimination of clutter.

Installation

Add this line to your application's Gemfile:

gem 'rubocop-kanso', require: false

And then execute:

bundle install

Or install it yourself as:

gem install rubocop-kanso

Usage

Add the following to your .rubocop.yml:

plugins:
  - rubocop-kanso

# Optional: Configure the cops
Kanso/NoRailsHelperRequire:
  Enabled: true

Kanso/NoRSpecDescribe:
  Enabled: true

Cops

Kanso/NoRailsHelperRequire

This cop disallows requiring rails_helper in spec files. Instead, configure your .rspec file in the project root with the following lines:

--require rails_helper

Bad:

require "rails_helper"

Good:

Configure .rspec file:

--require rails_helper

And remove the require statement from your spec files.

Auto-correction: ✅ Supported (removes the require statement)

Kanso/NoRSpecDescribe

This cop enforces using describe instead of RSpec.describe for consistency.

Bad:

RSpec.describe MyClass do
  # spec content
end

Good:

describe MyClass do
  # spec content
end

Auto-correction: ✅ Supported

Development

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

Testing

Run the test suite with:

bundle exec rspec

Building the Gem

To build the gem:

gem build rubocop-kanso.gemspec

Publishing

To release a new version:

  1. Update the version number in lib/rubocop/kanso/version.rb
  2. Run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org

Or manually:

gem build rubocop-kanso.gemspec
gem push rubocop-kanso-1.x.x.gem

Contributing

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

License

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