This repo has been archived as it no longer is needed to support SearchGov. (Tuesday August 18, 2026)
Shared Rubocop configuration for Search.gov repositories
Add this line to your application's Gemfile:
group :test, :development do
gem 'searchgov_style'
endAnd 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:
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.ymlinherit_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
Run:
$ bundle exec rubocopYou 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.
Install the development gems:
$ bundle
Run Rubocop on the gem repository itself:
$ 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
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/searchgov_style.
The gem is available as open source under the terms of the MIT License.