searchgov_style
Shared Rubocop configuration for Search.gov repositories
Installation
Add this line to your application's Gemfile:
group :test, :development do
gem 'searchgov_style'
end
And then execute:
$ bundle
Or install it yourself as:
$ gem install searchgov_style
In the root directory of the repo using this gem, create a .rubocop.yml
with the following directives:
For repositories that use Code Climate:
Refer to the work around for Code Climate's inability to use Rubocop's inherit_gem directive.
inherit_from:
- https://raw.githubusercontent.com/GSA/searchgov_style/main/.default.yml
For repositories that do not use Code Climate:
inherit_gem:
searchgov_style:
- .default.yml
-
Generate a
.rubocop_todo.yml
:rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 2000
-
Add the following entry to
.gitignore
:.rubocop*default-yml
Usage
Run:
$ bundle exec rubocop
You do not need to include rubocop directly in your application's dependencies. searchgov_style will include specific versions of rubocop
and related gems (such as rubocop-rspec
) that are shared across all projects.
Refer to the Rubocop documentation for Rubocop usage instructions.
Development
Install the development gems:
$ bundle
Run Rubocop on the gem repository itself:
$ rubocop
Upgrading Rubocop
To upgrade the version of Rubocop used by this gem, perform the following steps to ensure compatibility with CodeClimate:
- Verify that the new version is supported by CodeClimate:
list of Rubocop channels for CodeClimate - Verify that the new version is listed as a channel for the Rubocop engine for the CodeClimate CLI:
CodeClimate Engines - Bump the version of Rubocop in the gemspec
- Bump the Rubocop channel in .codeclimate.yml
Verify your configuration and compatibility locally using the CodeClimate CLI:
$ bundle update
$ codeclimate validate-config
$ codeclimate analyze lib/ -e rubocop
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/searchgov_style.
License
The gem is available as open source under the terms of the MIT License.