Skip to content

jaybocop/nonstandard

Repository files navigation

Nonstandard

This is an opinionated rubocp configuration.

  • Prefer most of the rubocop/ruby style guide community defaults
  • Enable performance, rails, rspec, faker, rake
  • Disable things that we'd find in a default rails app that we don't need (comments on config/application.rb for example)
  • Allow or expect comments on other things; models, controllers, etc.

Usage

Add this line to your application's Gemfile:

group :development do
  gem 'nonstandard', require: false
end

Add this to your project .rubocop.yml file

# Include one or more of the configurations below
inherit_gem:
  nonstandard:
    - ruby.yml # Vanilla ruby/rubocop/performance
    - rails.yml # Rails
    - rswag.yml # RSpec/rswag integration

And then execute:

$ bundle install

You can continue to add application-specific rules/overrides in the .rubocop.yml file in the root of your application, including annotating your todo list:

inherit_from: .rubocop_todo.yml

Development

Testing locally

In your application, use the path attribute to point to your local copy of the gem

    # Use the relative path from your application, to the nonstandard folder
    gem 'nonstandard', path: '../nonstandard', require: false

Publishing the gem

If you have access to publish the gem on rubygems:

  1. Update the version.rb file as appropriate
  2. bundle if any dependencies have changed
  3. Update the CHANGELOG.md
  4. Commit all changes & push to repo
  5. Merge version branch into main
  6. Tag the release on main
  7. Publish to rubygems

Tagging the release:

git tag -a <version>
git push origin <version>

Publishing to rubygems:

rake build
cd pkg
gem push nonstandard.<version_number>.gem

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jaybocop/nonstandard.

License

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